AngularJS password confirmation noMatch working but form is $invalid?
问题 I am using this code to make password input and confirm password input to match correctly Javascript: var app = angular.module('app', []); app.directive('validPasswordC', function() { return { require: 'ngModel', scope: { reference: '=validPasswordC' }, link: function(scope, elm, attrs, ctrl) { ctrl.$parsers.unshift(function(viewValue, $scope) { var noMatch = viewValue != scope.reference ctrl.$setValidity('noMatch', !noMatch) }); scope.$watch("reference", function(value) {; ctrl.$setValidity(