Angularjs: select not updating when ng-model is updated Angularjs: select not updating when ng-model is updated angularjs angularjs

Angularjs: select not updating when ng-model is updated


This is exactly why you should not use ngRepeat to render select options. You should use ngOptions instead:

<select ng-model="selectedDevice"         ng-options="i.value as (i.label + '-' + i.value) for i in inputDevice">    <option></option></select>

In general, avoid using ngRepeat for rendering select options. There are at least two good reasons. ngRepeat creates separate child scope per iteration, which is not needed in case of option tag. Another important caveat is that with ngRepeat you can only bind select to primitives like strings, but you won't be able to write object to ngModel with it.

Here is a demo below.