AngularJS ng-model value is lost after custom validation directive is triggered
问题 I created a custom validation directive and used it in a form. It can be triggered with no problem, but after the validation is triggered, I found that the model value is just lost. Say I have ng-model="project.key" and after validation, project.key doesn't exist in the scope anymore. I think somehow I understood AngularJS wrong and did something wrong. Code speaks. Here is my html page: <div class="container"> ... <div class="form-group" ng-class="{'has-error': form.key.$invalid && form.key.