UNPKG

angular-filter

Version:

Bunch of useful filters for angularJS(with no external dependencies!)

24 lines (22 loc) 586 B
/** * @ngdoc filter * @name where * @kind function * * @description * of each element in a collection to the given properties object, * returning an array of all elements that have equivalent property values. * */ angular.module('a8m.where', []) .filter('where', function() { return function (collection, object) { if(isUndefined(object)) return collection; collection = isObject(collection) ? toArray(collection) : collection; return collection.filter(function (elm) { return objectContains(object, elm); }); } });