Here is what seems to be bothering a lot of people (including me).
When using the ng-options
directive in AngularJS to fill in the options for a &
To send a custom value called my_hero
to the server using a normal form submit:
JSON:
"heroes": [
{"id":"iron", "label":"Iron Man Rocks!"},
{"id":"super", "label":"Superman Rocks!"}
]
HTML:
The server will receive either iron
or super
as the value of my_hero
.
This is similar to the answer by @neemzy, but specifying separate data for the value
attribute.