javascript - Passing value instead of whole object with ng-options -


i'm parsing .json file , showing available options in select:

<div bo-switch-when="dropdown">   <fieldset>       <select ng-options="options.text option in question.body.options" ng-model="question.answer" ></select>   </fieldset> </div> 

it working, not want to. instead of getting whole object model, want have value of object. via chrome dev tools:

this object (as in picture) in model. i want have text.

but when change ng-options this:

ng-options="options.text option.text in question.body.options" 

it isn't working @ all...

enter image description here

this pretty common question among angular developers.

you can use ng-repeat, so:

<select ng-model="question.answer" >   <option ng-repeat="option in question.body.options" value="{{option.text}}">{{option.text}}</option> </select> 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -