Rookie
Rookie

Reputation: 429

md-autocomplete md-require-match not working when setting the expression dynamically

I'm setting the autocomplete validation md-require-match = true/false based on the radio button selection.

Default validation is md-require-match = true so that user should select an item from autocomplete list. Once it load and user enter some value to the autocomplete input and clear the value, searchForm.autocompleteField.$error have this value: {"md-require-match":true,"required":true}

Now I'm selecting the radio button which is going to set md-require-match = false. But Its not removing md-require-match":true validation error from $error list.

Here is the code pen: http://codepen.io/anon/pen/NbrJoJ

How to fix this validation issue ?

Upvotes: 3

Views: 1417

Answers (1)

Gaurav Rathor
Gaurav Rathor

Reputation: 9

I had the same issue but I used $setValidity('md-require-match', true); on check of the true radio button. Now I am able to set the validity on click of radio button.

Upvotes: -1

Related Questions