dropdown - Not able to load JSON data into DropDownList in AngularJS -
i'm getting blank data while loading json data dropdown using angular ng-options.
my json values
"tagformat": { "displaytext": "tag format", "options": [{ "value": "js", "name": "js" }, { "value": "vast", "name": "vast" }] },
html view
<div class="select_padding"> <select class="form-control" ng-options="otf.value otf.name otf in details.tagformat.options"> <option>select tag format</option> </select> </div>
here details scope variable.
how these data , next time need use selected value. need bind ng-model ?
thanks
here working code:
<select class="form-control" ng-options="item item.name item in details.tagformat.options track item.value" ng-model="selected"> <option value="">select tag format</option> </select>
in $scope.selected
read selected item.
check example on codepen: http://codepen.io/beaver71/pen/vexwmr
Comments
Post a Comment