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

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -