在AngularJs隐藏字段 [英] Hidden fields in AngularJs

查看:109
本文介绍了在AngularJs隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何访问隐藏字段的角度?我有一个应用程序,在这里我想提交表单,每个列表中的项目。形式很简单 - 它提交按钮和一个隐藏字段持有ID值。但是,这是行不通的。该值为空。

How do I access hidden fields in angular? I have an app, where I want to submit a form for each of items in the list. The form is simple - it has submit button and a hidden field holding the ID value. But it does not work. The value is empty.

我更新了默认的角度例子来显示的情况 - 待办事项文本是隐藏字段。

I updated the default angular example to display the situation - the todo text is in hidden field.

http://jsfiddle.net/tomasfejfar/yFrze/

推荐答案

在您简单的小提琴,这个问题可以通过使用NG-init或设置控制器的初始值是固定的。在属性不会影响NG-模式。

In your simpler fiddle, the problem can be fixed by using ng-init or setting an initial value in the controller. The value attribute won't effect the ng-model.

http://jsfiddle.net/andytjoslin/DkMyP/2/

另外,你最初的例子(http://jsfiddle.net/tomasfejfar/yFrze/)对我的作品在其当前状态在Chrome 15 / Windows 7操作系统。

Also, your initial example (http://jsfiddle.net/tomasfejfar/yFrze/) works for me in its current state on Chrome 15/Windows 7.

这篇关于在AngularJs隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆