I'm trying to write an app using Angular-Material and I have a form that has some required fields that needs input validation. I've attempted following the example from the angular-material page under errors, but when I view the code in the browser, the error messages will still appear even if stuff is entered into the fields
My jade template looks like this:
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")
I didn't realize that ng-messages was a separate Angular module. Since this was a Node project, I imported angular messages using npm
npm install -S angular-messages
Then I modified my angular module code
var app = angular.module('MyApp', ['ngMaterial', 'ngMessages']);
... and it worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With