0

I have the issue with <md-autocomplete> component which is shown in this demo:

<md-autocomplete md-clear-button="true"> does not work. I would expect that a cross is shown at the end of the input field, like it is shown for official Basic Usage demo.

If someone can update the my demo so that clear button works, I will appreciate.

dma_k
  • 10,431
  • 16
  • 76
  • 128

2 Answers2

3

This actually works fine in current version v1.1.4 (perhaps above v1.1.2). See demo here.

Also, it seems this was intentional behavior while using md-floating-label for md-autocomplete according to some GitHub issues (#2727 and #7800)

If you don't have a choice of updating the angular-material version, you can have a look at this comment which turns out to be a somewhat applauded work-around.

Hope that helps!

tanmay
  • 7,761
  • 2
  • 19
  • 38
  • Thanks for effort. Maybe you have noticed in my demo that I tried to add top padding for all input fields with one CSS rule, however it makes `md-autocomplete` to incorrectly calculate the position of cross and also drop-down list. Do you think this is a bug or can it be relatively easy workarounded with CSS? – dma_k May 16 '17 at 19:23
  • https://codepen.io/anon/pen/vdbpYv?editors=1010 ..md-autocomplete reset is not working – its me Mar 01 '18 at 06:08
1

Update your angularjs-material version to 1.1.2 and above. Just compare versions 1.1.0 (under the attributes section) and 1.1.2 (there's a dedicative section for md-clear-button attribute)

NOTE: Looks like Google hasn't served angularjs-material for versions 1.1.2 and above. Use cdnjs instead.

UPDATE: Google now serves angularjs-material for versions 1.1.2 and above. More info

Here's the updated fiddle.

Edric
  • 24,639
  • 13
  • 81
  • 91
  • Thanks for noticing that! Perhaps that was the reason why I haven't pick up the latest version of the library: I couldn't locate it on Google site. – dma_k May 16 '17 at 19:26
  • @dma_k Looks like Google now serves versions 1.1.2 and above! – Edric May 30 '17 at 05:48
  • https://codepen.io/anon/pen/vdbpYv?editors=1010 ..md-autocomplete reset is not working – its me Mar 01 '18 at 06:09