angularjs - how to render the options inside angular select box -
how render values inside dropdown(selectbox options). need show 'header' , 'footer' names inside selectbox.
$scope.sections = [ { "header":{ "background-color":"#fff", "color":"#fff" }, "footer":{ "background-color":"#fff", "color":"#fff" } } ];
i tried in following way not working,
<select name="section" class="form-control" ng-model ="section"> <option ng:repeat="options[0] in sections"> {{options[0]}} </option> </select>
you need iterate on keys instead of values.
<option ng-repeat="(option, val) in sections[0]"> {{option}} </option>
or ng-options
ng-options="option (option, val) in sections[0]"
see plunker http://plnkr.co/edit/fqeool5wnh8xl8gprt99?p=preview
Comments
Post a Comment