Thursday, 12 September 2013

angularjs pass select option

angularjs pass select option

Using MVC 4 and angularjs, I'm trying to pass the selected option to my
controller. I can get this to work:
<select ng-model="record.Line">
<option value="1" id="line">1</option>
<option value="2" id="line">2</option>
<option value="3" id="line">3</option>
</select>
But I can't get this to work, nothing gets passed for the value:
<select ng-model="record.Line" value="record.Line" ng-options="l.name
for l in lines" />
I've tried using several different options for "value" but no luck. I
would prefer the second option if I can figure out why it isn't working.

No comments:

Post a Comment