Angular Material Entry Error Messages

I am trying to write an application using Angular -Material, and I have a form in which there are some required fields that require input confirmation. I tried to execute an example Angular page - material on errors , but when I view the code in a browser, error messages will still be displayed, even if the material is entered in the fields

Error messages displayed on the entered fields

My jade template is as follows:

form(name="accountForm") div(layout="row",layout-sm="column") md-input-container label Name input(name="acctName",ng-model="account.name",required) div(ng-messages="accountForm.acctName.$error") div(ng-message="required") 
+7
angularjs validation binding pug angular-material
source share
1 answer

I did not understand that ng messages are a separate Angular module. Since this was a Node project, I imported Angular posts using npm

 npm install -S angular-messages 

Then I changed the code of the Angular module

 var app = angular.module('MyApp', ['ngMaterial', 'ngMessages']); 

... and it worked!

validated fields with hidden messages

+10
source share

All Articles