How to make ngMessage for required fields only show when dirty or submitting a form?

前端 未结 12 2599
一个人的身影
一个人的身影 2020-12-08 02:31

I\'m using AngularJS 1.3.0 RC0 and angular-messages. ng-messages dutifully shows error messages for those \"required\" fields when a form is initially loaded and pristine. S

12条回答
  •  不知归路
    2020-12-08 02:54

    I did not want to show my message until there is any error or user tried to submit the page, and none of the above solution worked.

    Finally I ended up successfully with this:

    .......... ..........
    Required
    Maximum 50 characters.

    If you type anything which is not valid, then show the error

    If you try to submit the page and you have not provided the required field it will show error.

提交回复
热议问题