Tutorialsplane

Angular Material Autocomplete


Angular Material Autocomplete – Angular Material provides a special input component <md-autocomplte> with a dropdown of all possible matches of custom query. This component provides user the real time suggestions when a user types in an input area. The search results can be provided local or remote sources. Here in this tutorial we are going to explain how you can use Angular Material autocomplete.


Angular Material Autocomplete Example

Let us create a very simple example using the component <md-autocomplte>

JavsScript Part

JavaScript Contains the following code –

Angular Material – Autocomplete Example:


Html Part

Html Part Contains the following code –

Angular Material – Autocomplete Example:

 
  
  <div ng-controller="myCtrl as ctrl" layout="column" ng-cloak="">
  <md-content class="md-padding">
    
  </md-content>
</div>
  

Try it »

The advantage of autocomplete is that by default, md-autocomplete caches the results when performing a query(For remote data it loads data once and then caches). By this it eliminates the unneccessary requests. You can disabled this if you need.

If you run the above example it will produce output something like this –

Available Options

Following options are available-

Learn Angular Material