//html <div *ngIf="let notice of (news$ | async)"> ... //compoent refreshTImer$ = timer(0, 30000) news$ = this.service.news$ /*ngOnInit*/ this.sub = this.refreshTimer$.subscribe(this.service.refresh$) /*ngOnDestroy*/ this.sub.unsubscribe() //service loadNews$ = this.http.get('/newsfeed')... refresh$ = new BeharviorSubject(null); news$ = this.refresh$.pipe( exhaustMap( () => this.loadNews$) )
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter