My code for select with ng-model is working fine except filter stuff.
Without filter, it’s showing duplicated option for the already selected one..
So I am trying to filter out the one already selected in below code.
But it’s not working.. Am I doing something wrong? any help please?
<select ng-model="result.color">
<option ng-repeat="codes in obj.codes | filter:!result.color" value="{{codes.code}}">{{codes.code}}</option>
<option ng-selected>{{result.color}}</option>
</select>
ng-selectedaccepts an expression.This is what I would do:
== edit ==
another even shorter solution would be to use
ng-options.Here is the fiddle: http://plnkr.co/edit/oIysU5
Not sure about the initial value as my fiddle seems working.