javascript - Using selected for Dynamic options in Angularjs -
i having dynamic list of data showing dropdownlist. want 1 selected when user enters page.
<div class="row"> <div class="col"> <select ng-model="item1" style="width:100%;text-align:center;"> <option style="text-indent:30%" ng-repeat="item1 in ideamonthlist" value="{{item1}}" >{{item1}}</option> </select> </div> </div>
this how making dropdown list.
var ideamonth=["1","2","3","4","5","6","7","8","9","10","11","12"] $scope.ideamonthlist=ideamonth;
this array of months.by deafult when user enters page current month should selected in dropdownlist.
using can choose option static option. how dynamic options
use ngoptions in angularjs.
the ngoptions attribute can used dynamically generate list of elements element using array or object obtained evaluating ngoptions comprehension expression.
<select ng-model="item1" ng-options="item item in ideamonthlist" style="width:100%;text-align:center;"></select>
Comments
Post a Comment