drop down menu - AngularJS - Default Dropdown Select Option -


this 1 issue bugging me since seems easy fix.

i using plain html, data being passed next view via angular.

the snippet of code looks this:

<span data-ng-show="iscountry()">   <select class="selectpicker" data-ng-model="age">     <option value="21">21-24</option>     <option value="25">25-30</option>     <option value="31">31 , up</option>   </select> </span> 

what trying achieve: having <option value="25">25-30</option> default selected option when angular loads

what i've tried:

  1. having <option value="25">25-30</option> ng-selected="age" attribute

    <span data-ng-show="iscountry()"> <select class="selectpicker" data-ng-model="age"> <option value="21">21-24</option> <option ng-selected="age" value="25">25-30</option> <option value="31">31 , up</option> </select> </span>

  2. having <option value="25">25-30</option> selected="selected" attribute

    <span data-ng-show="iscountry()"> <select class="selectpicker" data-ng-model="age"> <option value="21">21-24</option> <option selected value="25">25-30</option> <option value="31">31 , up</option> </select> </span>

  3. even trying <option value="25">25-30</option> displayed first

    <span data-ng-show="iscountry()"> <select class="selectpicker" data-ng-model="age"> <option value="25">25-30</option> <option value="21">21-24</option> <option value="31">31 , up</option> </select> </span>

option 2 , 3 display value want first, not passed through next view

if possible, prefer not touch angular code, main developer out temporary...

any appreciated.

thanks!

apparently, after digging code - age being set via js function

a.defaultage = {   country: "25" } 

thanks david - comment good know thing future reference.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -