Blaise提出了一个问题：AngularJS: ng-if not working in combination with ng-click?，或许与您遇到的问题类似。
- Why does 1 not work?: Because an ngIf defines its own scope, which prototypically inherits from its parent scope (just like ngRepeat). So, when you change the value of a field inside an ngIf, you change it in the ngIf scope, and not in its parent scope.
- Should 1 work?: No
- Why does 2 work?: Because in that case you modify the content of an object which is referenced by the ngId scope, through inheritance.
- Should 2 work?: Yes
- Can I rely 2 to work in future updates of AngularJS?: Why shouldn't you?
This scope inheritance mechanism is explained very well in https://github.com/angular/angular.js/wiki/Understanding-Scopes