【发布时间】:2014-07-14 23:03:29
【问题描述】:
angularjs 模板中的value 和ng-value 属性有什么区别?如果我在使用值属性的字段上使用ng-if,它可以正常工作,但如果我将属性value 更改为ng-value,它将停止工作。
example 1 // it works
<input type='radio' ng-model='difficulty' value='hard'/>
<div ng-if="difficulty == 'hard'">
<p>difficulty is hard</p>
</div>
Example 2 // it doesn't work
<input type='radio' ng-model='level' ng-value='hard'/>
<div ng-if= "level == 'hard'" >
<p>level is hard</p>
</div>
【问题讨论】:
标签: javascript angularjs angularjs-scope angularjs-ng-repeat angularjs-service