这是显示问题的小提琴.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>
Run Code Online (Sandbox Code Playgroud) angularjs ×1