material icon indicating copy to clipboard operation
material copied to clipboard

md-autocomplete + md-min-length="0" + required fails (throws exception)

Open bvilches opened this issue 11 years ago • 5 comments

Open the md-autocomplete demo in Code Pen and add the required property to it.

Now select one state and start backspacing the content. When you delete the final letter you will get an exception: "Cannot read property 'toLowerCase' of undefined".

This is happening at line 17857 in the handleQuery function:

function handleQuery () {
    var searchText = $scope.searchText,
    term       = searchText.toLowerCase();
}

Somehow, the $scope.searchText is undefined instead of being an empty string. The weird thing is that this only happens when the md-autocomplete is required.

Of course you will only see it if md-min-length is 0.

bvilches avatar Oct 14 '15 16:10 bvilches

+1

rafaelgondim avatar Oct 14 '15 21:10 rafaelgondim

+1

michelbb avatar Oct 22 '15 14:10 michelbb

+1

gamame avatar Oct 23 '15 08:10 gamame

http://codepen.io/anon/pen/rOJgGK

input empty

gamame avatar Oct 24 '15 04:10 gamame

+1

makkart avatar Oct 26 '15 21:10 makkart