How can I unbind(remove) angular models when not in DOM
问题 Here is a simple demonstration of what I'm struggling to achieve. <div ng-controller="MyCtrl"> <input type="button" ng-click="a=!a" value="toggle a"/> <div ng-if="a"> <input type="text" ng-model="del.a1" />{{del}} </div> <input type="text" ng-model="del.a2" /> {{del}} </div> Initially the value of del is {} and ng-if is false the property a1 is under ng-if condition. Test Case : step 1 : toggle the ng-if to true so that a1 is visible step 2 : enter some value into a1 (you can anytime enter