I have this input:
<form #f="ngForm" name="productForm">
<md-input [(ngModel)]="product.price" name="price" required="true" placeholder="Price (USD)"></md-input>
<div ng-messages="productForm.price.$error" role="alert">
<div ng-message-exp="['required']">
Price is required
</div>
</div>
</form>
But the message Price is required doesn't show up.
How should I properly format the error message?
The ng-invalid class appears when the price input is empty:
Angular injects ng-valid class in it.
I want is to have the style similar to angular1 md design that looks like this:
Validation messages can now be inserted with Angular Material version 2.0.0 onward. Check the documentation here.
Hopefully this will be added as angular2-material evolves, but currently the way to mimic this is to set the dividerColor and use the MD-HINT directive. example: