Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.21 KB

README.md

File metadata and controls

31 lines (22 loc) · 1.21 KB

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.