Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear the md-autocomplete cache?

I'm using md-autocomplete to show results of an api query. Attribute md-items is iterating over a promise: item in getItems(searchText).

This is working well, and using the cache subsequent uses of the same search text return immediately with the same results.

But I need to be able to clear the cache at some points, when other search parameters change. How can I do this? By accessing the md-autocomplete controller perhaps? Although that seems non-standard and I'm not sure how.

like image 690
Justin Caldicott Avatar asked Aug 08 '15 13:08

Justin Caldicott


1 Answers

As of version 1.0.5 of angular-material this isn't possible. I didn't find any acceptable workarounds, so I'm just disabling the cache with md-no-cache="true".

I've logged an issue for this on the angular-material project including a suggestion on how it could work.

like image 196
Justin Caldicott Avatar answered Sep 28 '22 01:09

Justin Caldicott