0.1.0 • Published 4 years ago

angularjs-async-filter v0.1.0

Weekly downloads
15
License
MIT
Repository
github
Last release
4 years ago

AngularJS Async Filter

npm version CircleCI MIT license

How to use

This package is built as a UMD module. You can import it the way you like.

  1. import module
angular.module('MY_MODULE', [ 'AsyncFilterModule' ]);
  1. Use in template. Input object can be either a Promise or Observable.
<span>{{ myPromise$ | async:this }}</span>
<span>{{ myObservable$ | async:this }}</span>

Use with CDN

<script src="https://unpkg.com/angularjs-async-filter@0.1.0/lib/index.min.js"></script>

⚠️ Caveat

This filter will handle subscription and unsubscription upon $scope is created and destroyed. But please be mindful that reassign the input of the filter will make previous object not being garbadge collected until the controller is destroyed.

If possible, using ng-if to toggle the filter would be more performant and memory-friendly.