AngularJS form validation directive for showing input errors

后端 未结 4 2158
我寻月下人不归
我寻月下人不归 2021-02-01 09:12

I need to create a validation directive for showing all input errors for each input automatically. This validation directive should show all errors at current moment and list of

4条回答
  •  名媛妹妹
    2021-02-01 09:46

    Take a look at the ng-messages directive. Its fairly elegant. Example:

    You did not enter a field
    The value entered is too short

    You can then combine it with any form validation. Just place the error messages from the validators onto the elements $error object and they are automatically rendered in your UI.

提交回复
热议问题