Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement