Angular JS: Pass a form's select option value as parameter on ng-submit="doStuff()"

angularjs

Solution

You dont need to pass the dropdown's value to the submit handler.

It would be available as $scope.menu inside the doStuff method.

Also, you should use angular's ng-options to fill the options inside the dropdown:

<form ng-submit="doStuff()">
<select ng-model="menu" ng-options="item.name for item in items">       
</select>

Problem

I've simplified my code down to this: ``` <form ng-submit="doStuff($('select').val())"> <select name="menu"> <option value="foo">bar</option> </select> </form> ``` When I submit the form, I want angular to pass `<select>`'s value is to the function `doStuff()`. Whats the best way to go about this?

Original source