0

I have a angular form with a few inputs. I need to know when the input is empty when I click a button to search without refresh the browser.

 <input ng-model="formData.city" type="text" id="city-selector" placeholder="Ciudad o localidad" onfocus="this.value = '';">

If I make a search with a city "City", the next time I search with the value "" I get "City" in the controller. How can I delete this value without delete the $scope.formData?

Thanks

1 Answer 1

1

Try to use ng-focus="formData.city = ''" rather than onfocus="this.value = '';"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.