我是 AngularJS 的新手,我在 ng-repeat 生成的单选按钮上单击了 ng-click,并且 click 事件拒绝触发。如果我使用简单的onclick,那确实有效。
这有效,我看到了警报:
<div class="span2 left-justify"
ng-repeat="choice in physicalmode_choices">
<input type="radio"
name="physical_layer"
value="{{ choice.private }}"
onclick="alert('foo')"
required
ng-model="$parent.networkoptions.physicalmode" />
<span ng-bind="choice.public"></span>
</div>
但这不会:
<div class="span2 left-justify"
ng-repeat="choice in physicalmode_choices">
<input type="radio"
name="physical_layer"
value="{{ choice.private }}"
ng-click="alert('foo')"
required
ng-model="$parent.networkoptions.physicalmode" />
<span ng-bind="choice.public"></span>
</div>
我不能用 ng-click 做到这一点吗?还是我误解了什么是“表达”?
谢谢,迈克