Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

docs(autocomplete): common issue inside of virtual repeat #9842

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/components/autocomplete/js/autocompleteDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,37 @@ angular
* There is an example below of how this should look.
*
* ### Notes
* **Autocomplete Dropdown Items Rendering**
*
* The `md-autocomplete` uses the the <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeat</a>
* directive for displaying the results inside of the dropdown.<br/>
*
* > When encountering issues regarding the item template please take a look at the
* <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> documentation.
*
* **Autocomplete inside of a Virtual Repeat**
*
* When using the `md-autocomplete` directive inside of a
* <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> the dropdown items might
* not update properly, because caching of the results is enabled by default.
*
* The autocomplete will then show invalid dropdown items, because the VirtualRepeat only updates the
* scope bindings, rather than re-creating the `md-autocomplete` and the previous cached results will be used.
*
* > To avoid such problems ensure that the autocomplete does not cache any results.
*
* <hljs lang="html">
* <md-autocomplete
* md-no-cache="true"
* md-selected-item="selectedItem"
* md-items="item in items"
* md-search-text="searchText"
* md-item-text="item.display">
* <span>{{ item.display }}</span>
* </md-autocomplete>
* </hljs>
*
*
*
* @param {expression} md-items An expression in the format of `item in results` to iterate over
* matches for your search.<br/><br/>
Expand Down