an angularJS array filter, that supports deep document filtering
If you do not have nodejs installed on your machine, download and install NodeJS.
Install ng-array-filter npm package ng-array-filter:
With Bower:
$ cd <project path>
bower install --save ng-array-filter
With NPM:
$ cd <project path>
npm install --save ng-array-filter
-
Import the
dist/ng-array-filter.min.js
script and include the moduleng-array-filter
into app.js -
OR
require('ng-array-filter')
into app.js. -
Use it as an angular filter:
var ctrl.items = [
{
name: 'fan',
brands: ['Lasko', 'GE', 'Hamilton Beach', 'Sunbeam']
},
{
name: 'microwave oven',
brands: ['GE', 'Hamilton Beach', 'Sunbeam']
}
];
<!--
to get the all items that have brand **Lasko**
-->
<div ng-repeat="item in ctrl.items | ngArrayFilter: {brands: 'lasko'}">
...
</div>
<!--
Want case sensitive filtering?
pass boolean parameter caseSensitive
-->
<div ng-repeat="item in ctrl.items | ngArrayFilter: {brands: 'Lasko'}: true">
...
</div>
deep query
var ctrl.items = [
{
name: 'fan',
"brands": [
{"name": "Lasko", "price": 25},
{"name": "GE", "price": 22.25},
{"name": "Hamilton Beach", "price": 18},
{"name": "Sunbeam", "price": 19}
]
},
{
name: 'microwave oven',
"brands": [
{"name": "GE", "price": 55.00},
{"name": "Hamilton Beach", "price": 49.99},
{"name": "Sunbeam", "price": 45}
]
}
];
<!--
to get the all items that have brand name **Lasko**
-->
<div ng-repeat="item in ctrl.items | ngArrayFilter: {brands: {name: 'Lasko'}}">
...
</div>
- If you planning add some feature please create issue before.
- Don't forget about tests.
Clone the project:
$ git clone
$ npm install
$ bower install
Run the tests:
$ mocha
Deploy:
Run the build task, update version before(bower,package)
$ gulp build
$ git tag v*.*.*
$ git push origin master --tags
If you do find an issue or have a question consider posting it on the Issues.