Filter md-autocomplete items without function

This is about filtering items without function in the controller.

<md-autocomplete md-selected-item="ctrl.sampleValue" 
                 md-search-text="searchText" 
                 md-items="item in ctrl.items | filter:searchText"
                 md-item-text="item.value">
  <md-item-template>
    <span md-highlight-text="searchText"></span>
  </md-item-template>
</md-autocomplete>

That’s it! You do not need any code for filtering items when searchText changes. filte takes care of everything!

If you want to work more, Code pen is provided below.

See the Pen md-autocomplete preselected when object is passed by Kohei Arai (@1kohei1) on CodePen.