Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Is that possible to store some additional data along with the error flag itself, using standard Angular mechanism?

    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 521
    Answer it

    I'm manually setting ngModel.$setValidity, I'd like to pass some data along with the error flag, to be displayed in ngMessages directive. For example let's assume the min/max length of the field depends upon some external factors, thus is computed & validated server-side. The server respons with customlength error code along with max and min properties, which I'd like to display to the user. Currently I'm simply setting ngModel.$setValidity("customlength", false); but I'd like to pass {max: response.max, min: response.min} along, to be interpolated in the template like

    the length should be between {{ data.min }} and {{ data.max }}

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: