select - How to add a default option with value -1 and have that selected Angularjs -


using select ng-options leads selected option value '?'

<select ng-model="somethinghere"           ng-options="option.value option.name option in options"          class="ng-pristine ng-valid">      <option value="?" selected="selected"></option>     <option value="0">something cool</option>     <option value="1">something else</option> </select> 

i need have

<option value="-1" selected="selected"></option>         <option value="0">something cool</option>         <option value="1">something else</option> 

how can this? how can add default option value -1 , set selected. using

 <select ng-model="somethinghere"               ng-options="option.value option.name option in options"              class="ng-pristine ng-valid">          <option value="-1" ng-selected> select</option>      </select> 

does not work.

init model value value of default:

<select ng-model="somethinghere"           ng-options="option.value option.name option in options"          class="ng-pristine ng-valid" ng-init="somethinghere=-1">     <option value="-1"> select</option> </select> 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -