Tuesday, 15 January 2013

validation - Angularjs >1.3 $validator causes modelValue to go undefined -


I am using $ validator to write a custom form verification instructions.

Currently it looks like this:

  module.directive ('tweetLength', function (URLDetector) {return {restricted: 'a', is required: 'NgModel', link: function (scope, element, etters, CTLL) {users with permission of var}; permissions = parasant (attrs.tweetLength); ctrl. $ Validators.tweetLength = function (modelValue, viewValue) {var results; Return result = URLDetector.url has been adjusted; printRate (modelValue) & lt; = Permissions Recipients;};}};});  

This examines the model of the element which is connected to the number of characters, while the account link shortening (hence the ng-minlength and Ng-maxlength do not work). Needs are not fulfilled when it lied. The problem is that when this false modelValue returns is undefined I know that means to store this point in $$ invalidModelValue , But I still need the value in the original model because it is being used elsewhere in the scene.

Is there a way to move the corner and prevent it from being the original model undefined ? I know that this problem can be resolved in the Form Controller, but I do not think it is the right way to do this because I want to disable the form submission button by using the form and not some external variable. Is there an alternative way to approach this problem when using aggregation form validation?

Angular v. The value of ng-model is undefined (docs)

set to start in 1.3, when the return is incorrect, to prevent this behavior, allowInvalid < / Code> set the correct property, such as:

  ng-model-option = "{permissions invalid: true}"  

No comments:

Post a Comment