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

Commit 82b80ee

Browse files
committed
docs(autocomplete): common issue inside of virtual repeat
* Developers might have an autocomplete component inside of a VirtualRepeat container and will wonder why the autocompletes dropdown items are not updating. * This is because the VirtualRepeat only updates the scope bindings (rather than re-creating the autocomplete - Recycler View) and the autocomplete previously cached the results and now displays the old ones. Closes #9815.
1 parent d455bb3 commit 82b80ee

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/components/autocomplete/js/autocompleteDirective.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,34 @@ angular
3535
* There is an example below of how this should look.
3636
*
3737
* ### Notes
38+
* **Autocomplete Dropdown Items Rendering**
39+
*
3840
* The `md-autocomplete` uses the the <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeat</a>
3941
* directive for displaying the results inside of the dropdown.<br/>
42+
*
4043
* > When encountering issues regarding the item template please take a look at the
4144
* <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> documentation.
4245
*
46+
* **Autocomplete inside of a Virtual Repeat**
47+
*
48+
* When using the `md-autocomplete` directive inside of a
49+
* <a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> the dropdown items might
50+
* not update properly, because caching of the results is enabled by default.
51+
*
52+
* > To avoid such problems ensure that the autocomplete does not cache any results.
53+
*
54+
* <hljs lang="html">
55+
* <md-autocomplete
56+
* md-no-cache="true"
57+
* md-selected-item="selectedItem"
58+
* md-items="item in items"
59+
* md-search-text="searchText"
60+
* md-item-text="item.display">
61+
* <span>{{ item.display }}</span>
62+
* </md-autocomplete>
63+
* </hljs>
64+
*
65+
*
4366
*
4467
* @param {expression} md-items An expression in the format of `item in results` to iterate over
4568
* matches for your search.<br/><br/>

0 commit comments

Comments
 (0)