0

I need to submit a form on AngularJS. It's a search form, using Elastic Search. Sometimes the search don't bring any result, and i need to click on the button again.

It's possible to "re-submit" a form automatically if there are results on the search?

Thanks!

2 Answers 2

3

Use (onclick) directive like this :

<button(onclick)='test()'>Submit</button>
Sign up to request clarification or add additional context in comments.

Comments

1

call the click programatically

angular.element('#myButton').triggerHandler('click');

or submit the form by doing

form.$setSubmitted();

4 Comments

from the angular element docs If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or jqLite. the setsubmitted on the form is just ngForm FormController
@MatheusSartori did this help you?
Yes, i fixed the issue on my system. Ty!
please accept my answer if it helped you so future visitors know where to look

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.