1.0.7 • Published 5 years ago

ngx-async v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
5 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

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago