1.0.7 • Published 6 years ago

ngx-async v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ngx-async

Bind observable to class property. Unlike async pipe it works in component.

Demo

Live example on stackblitz

Install

npm install ngx-async

Usage

component.ts

import { Component, OnDestroy } from '@angular/core';

import { interval } from 'rxjs';
import { map } from 'rxjs/operators';

import { Async } from 'ngx-async';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent implements OnDestroy {
  @Async currentTime = interval(1000).pipe(
    map(() => Date.now()),
  );

  ngOnDestroy() {
    // assign null for unsubscribe
    this.currentTime = null;
  }
}

component.html

   <p>Now {{ currentTime | date:'HH:mm:ss' }}</p>
1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago