这是小提琴展示的问题。http://jsfiddle.net/Erk4V/1/
如果我在ng-if中有一个ng-模型,那么模型就不能像预期的那样工作。
我想知道这是一个错误,还是我误解了正确的用法。
<div ng-app >
<div ng-controller="main">
Test A: {{testa}}<br />
Test B: {{testb}}<br />
Test C: {{testc}}<br />
<div>
testa (without ng-if): <input type="checkbox" ng-model="testa" />
</div>
<div ng-if="!testa">
testb (with ng-if): <input type="checkbox" ng-model="testb" />
</div>
<div ng-if="!someothervar">
testc (with ng-if): <input type="checkbox" ng-model="testc" />
</div>
</div>
</div>