Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.17 KB

README.md

File metadata and controls

63 lines (39 loc) · 1.17 KB

ng-operators

npm version CircleCI

RxJS operators for Angular

Install

$ npm install --save ng-operators

Usage

  • Import all operators
import 'ng-operators/add/all';

response$.mapToResponseJson().subscribe(...);
  • Import single operator
import 'ng-operators/add/mapToResponseJson';

response$.mapToResponseJson().subscribe(...);
  • Import single operator as a function
import { mapToResponseJson } from 'ng-operators';

mapToResponseJson.call(response$).subscribe(...);

Operators

mapToResponseJson<R>

  • Input: Observable<http.Response>
  • Output: Observable<R>

A shorthand of .map(resp => resp.json() as R)

mapToResponseText

  • Input: Observable<http.Response>
  • Output: Observable<string>

A shorthand of .map(resp => resp.text())

onNavigationEnd

  • Input: Observable<router.Event>
  • Output: Observable<router.NavigationEnd>

A shorthand of .filter(e => e instanceof NavigationEnd)

License

MIT