假设我有类似的东西
<div ng-if="{{someCondition}}">
<input type="text" ng-model="myVariable"/>
</div>
如果 someCondition
为假并且该 DIV 被从 DOM 中删除,如果 $scope.myVariable
发生任何事情怎么办?
最佳答案
没有任何反应 (see reference) .
ng-if
只是确定是否在 DOM 中创建了 html 元素。当它存在时 <input>
值双向绑定(bind)到 $scope.myVariable
.
关于javascript - 如果 ng-if 的计算结果为 false,AngularJS 我的模型数据会变得无效吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36285780/