SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, Input, OnInit } from "@angular/core";
  2. import { interval, Subscription } from "rxjs";
  3.  
  4. import { WithSubscription } from "./with-subscription";
  5.  
  6. @Component({
  7.   selector: "counter",
  8.   template: `
  9.     <div>Count {{ count }}</div>
  10.   `
  11. })
  12. export class CounterComponent extends WithSubscription {
  13.   count = 0;
  14.  
  15.   ngOnInit() {
  16.     this.subscribe(interval(1000), value => {
  17.       this.count++;
  18.       console.log(value);
  19.     });
  20.   }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top