0.0.4 • Published 9 years ago
ng-array-filter v0.0.4
ngArrayFilter
an angularJS array filter, that supports deep document filtering
Getting started
Prerequisites
If you do not have nodejs installed on your machine, download and install NodeJS.
Installation
Install ng-array-filter npm package ng-array-filter:
With Bower:
$ cd <project path>
bower install --save ng-array-filterWith NPM:
$ cd <project path>
npm install --save ng-array-filterHow to use
Import the
dist/ng-array-filter.min.jsscript and include the moduleng-array-filterinto app.jsOR
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>Contributing
- If you planning add some feature please create issue before.
- Don't forget about tests.
Clone the project:
$ git clone
$ npm install
$ bower installRun the tests:
$ mochaDeploy: Run the build task, update version before(bower,package)
$ gulp build
$ git tag v*.*.*
$ git push origin master --tagsIssues
If you do find an issue or have a question consider posting it on the Issues.