angularjs - Angular JS filtering out used ids from a separate array -
i've got object of articles contain articles on site id in ng-repeat. have array inside products object of attached articles id in repeat.
trying show articles not attached product. not sure how iterate on arrays , find matches , exclude them returned object.
https://gist.github.com/irthos/0565c66be0ab992adc0a
is there way can ng-repeat="article in articles | (except when product.articles.$id === article.$id)"?
var app = angular.module('app', []); app.controller('mainctrl', function($scope) { $scope.name = 'world'; $scope.search = 1; $scope.familes = [{ id:1, name: "kruders", kids: [ { name: "zoe" } ] }, { id:2, name: "halifax", kids: [ { name: "mike" } , { name: "jim" } ] }, { id:3, name: "judes", kids: [ ] }] });
<html ng-app="app"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <body ng-controller="mainctrl"> <input type="number" ng-model="search" /> <ul> <li ng-repeat="family in familes | filter :{id:'!'+search}">id: {{family.id}} - name:{{family.name}}</li> </ul> </body> </html>
ng-repeat="article in articles | filter :{id:'!'+product.articles.$id})
Comments
Post a Comment