4

I am new to Angularjs. Currently i have code like this that submits the form on button click

<form ng-submit="reloadA(resultsPerPage)">
    <select ng-model="resultsPerPage">
    <option value="10">10</option>
    <option value="25">25</option>
    </select>
     <input type="submit" id="submit" value="Submit" />
    </form>

I need that form should be submitted on selecting the option without need of the submit button

2 Answers 2

2

ok, for this you should have that ng-submit function in the select, like this;

<form>
   <select ng-change="reloadA(resultsPerPage)" ng-model="resultsPerPage">
      <option value="10">10</option>
      <option value="25">25</option>
   </select>
   <input type="submit" id="submit" value="Submit" />
</form>
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot !! saved the day :)
ok, I see. thanks man, I also just learnt this one or two weeks ago; also an angularjs noob :D
1

I believe you can use ng-change here

<select ng-model="resultsPerPage" ng-change="reloadA(resultsPerPage)">

2 Comments

damn you I was first!
+10 in the spirit of sportsmanship, they're basically the same answer anyways. . .now if i can just get that sportsmanship badge...

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.