vendredi 29 mai 2015

angularjs - not able to invalidate input (Object doesn't support property or method '$setValidity')

I try to do the following

if ($scope.RetypePassword != $scope.resource.Password) {
     $scope.resource.Password.$setValidity("missmatch", false);
} else {
     $scope.resource.Password.$setValidity("missmatch", false);
}

but fail with this error

TypeError: Object doesn't support property or method '$setValidity'

What can the reason be?

resource.Password is databound to an input like this

<input type="password" ng-model="resource.Password" name="Password" />

Aucun commentaire:

Enregistrer un commentaire