Skip to content

Instantly share code, notes, and snippets.

@yjaaidi
Created May 30, 2018 12:53
Show Gist options
  • Save yjaaidi/2908ba65b139f3c945216b3df47e6ca7 to your computer and use it in GitHub Desktop.
Save yjaaidi/2908ba65b139f3c945216b3df47e6ca7 to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { interval } from 'rxjs';
import { shareReplay } from 'rxjs/operators';
@Component({
template: `
<div>{{ count$ | async }}</div>
<div>{{ count$ | async }}</div>
`
})
export class CounterComponent {
count$ = interval(1000)
.pipe(shareReplay(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment