I'm using version 0.7.1 of angular material. I'm using the autocomplete as described here: Autocomplete demo
However, it doesn't seem to support validation logic, even though it generates a textarea: Autocomplete directive documentation
I imagine that I can add logic in the querySearch function to switch ng-valid to ng-invalid. Is this correct? If this is the case, then I need a handle on the md-autocomplete, but this is difficult, because the name attribute gets removed.
It seems that I am not the only one to find this tricky. There will be a solution to this soon: Autocomplete validation improvements in progress
Quick update, got the solution on Angular Material site (Latest release 1.0.0-), https://material.angularjs.org/latest/demo/autocomplete.
You will find that 'required' and 'ng-messages' are supported now.
I was working with same approach with the form validation using auto-complete in angular materials.But unfortunately, validation on this directive is not so smooth as input components. So I made up my mind to overcome this issue and did some R&D for this component. Please find below code snippets and they will help you out on this.
HTML:
SCRIPT:
See the full example of codepen here
Read documentation
you need these options
You can use above as below to run yr custom validation :
Update yr template as below
and add following yr md-auto-complate controller