javascript - how to skip value in ng-repeat if it is already in another list? -


i have, example, person data tags following:

$scope.person.groups = ['ios'] 

and tags list:

$scope.tagslist = ['android', 'ios', 'pm'] 

how display ['android', 'pm'] ng-repeat?

i tried:

<li ng-repeat="tag in tagslist" ng-show="tag != person.groups">{{tag}}</li> 

but didn't work.

how display records not in second array?

you should use filter. here's how can it:

html:

<li ng-repeat="tag in tagslist | arrfilter: person.groups">{{tag}}</li> 

filter:

app.filter('arrfilter', function() {     return function(collection, person) {         var output = [];         angular.foreach(collection, function(item) {             if(person.indexof(item) == -1) {                 output.push(item);             }         })         return output;     } }) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -