Angular.js - ng-change not firing when ng-pattern is $invalid

后端 未结 4 2085
别那么骄傲
别那么骄傲 2020-12-13 06:43

I am using ng-pattern to validate some form fields, and I am using ng-change with it to watch and process any changes, however ng-change (or $scope.$watch) will only fire wh

4条回答
  •  醉梦人生
    2020-12-13 06:54

    You can change the behavior of your input by using ng-model-options.

    Just add this attribute to your input and the ng-change event will fire:

          ng-model-options="{allowInvalid: true}"
    

    see: https://docs.angularjs.org/api/ng/directive/ngModelOptions

提交回复
热议问题