I have a choice where I fill in certain values, as shown below:
Values:
$scope.obj = {codes: [
{code: 1},
{code: 2},
{code: 3}
]};
Now I want to dynamically filter certain values without making any changes to the value of $ scope.obj, that is, I do not want to display the value of {code: 1}. I set this value in another variable in the $ scope:
$ scope.selectedCode = {code: 1};
All values present in the selected code should not be displayed in the drop-down list. I think this can be done using the angular js filter expression:
<select ng-options="c.code for c in obj.codes | filter:'c.code !== selectedCode .code'" ng-model="selected">
But the above shows an empty snapshot.
Any help / guidance is appreciated. Thanks in advance.:)
source
share