8

When I tried using the below syntax, it doesn't filter or doesn't exclude:-

ng-repeat = "option in vm.eesSettingIdOptions | filter : { SettingID: '!vm.eesAdminSetupData.SettingID'}

but it do works when I change it to:-

ng-repeat = "option in vm.eesSettingIdOptions | filter : { SettingID: '!51'}

they should be the same isn't it?

2 Answers 2

13

you should put your variable out of the quotes:

ng-repeat="option in vm.eesSettingIdOptions | filter:{ SettingID: '!' + vm.eesAdminSetupData.SettingID}
Sign up to request clarification or add additional context in comments.

4 Comments

I still have one issue. It's in a select options..when I tried to select..it doesn't shows anything but blank <option ng-repeat="option in vm.eesSettingIdOptions | filter:{ SettingID: '!'+ vm.eesAdminSetupData.SettingID} " value="{{option.SettingID}}">{{option.SettingID}} - {{option.Name}}</option>
when I tried to select an option..it doesn't shows anything but blank <option ng-repeat="option in vm.eesSettingIdOptions | filter:{ SettingID: '!'+ vm.eesAdminSetupData.SettingID} " value="{{option.SettingID}}">{{option.SettingID}} - {{option.Name}}</option>
@Roel if this answer has solved your original problem then please accept it as the solution to your question. If you then need to ask another question, do not ask it in the comments, but create a new question instead. If you want z0r0 to look at your new question then you can leave him a comment under his answer and link to your new question. However, if you don't award the answer/upvote then he will probably not be inclined to help you next time.
4

Modified your code, Please refer below changes.

ng-repeat="option in vm.eesSettingIdOptions | filter:{ SettingID:'!option.SettingID'}

Try using this way, it will work.

4 Comments

I tried that but it doesn't exclude option.SettingID in the option lists.
you also cannot wright like 'vm.eesAdminSetupData.SettingID'. because while looping this don't know which value have to map.
Just try moving out single quote from suggested code.
Yes, I tried the suggested code. However, when I tried to select an option..it doesn't shows anything but blank <option ng-repeat="option in vm.eesSettingIdOptions | filter:{ SettingID: '!'+ vm.eesAdminSetupData.SettingID} " value="{{option.SettingID}}">{{option.SettingID}} - {{option.Name}}</option>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.