I have updated material then I update my code like that
<md-input-container>
<label>Last Name</label>
<input name="lastName" ng-model="lastName" required>
<div ng-messages="userForm.lastName.$error" ng-show="userForm.lastName.$dirty">
<div ng-message="required">This is required!</div>
</div>
</md-input-container>
It will highlight on the input when I dirty the field; however, I want to click on submit button and show highlight on the input even I don't dirty that required field.
Here is my plunker http://plnkr.co/edit/oAWaFr8OtBusRli4v8MS?p=preview I want to click on Save button and then show error highlight on the input field.
Update your html as below
Add a custom validation function inside your Controller
PLUNK HERE
You have to add
type="submit"
to bind your save button with form that means you are going to submit your form.From your plunkr
to fire angular function on save button add
ng-submit
to your formUpdated plunkr