Skip to content

Instantly share code, notes, and snippets.

@msarsha
Created January 11, 2021 18:44
Show Gist options
  • Save msarsha/f29a37eaf9031b397761fe74af2650e2 to your computer and use it in GitHub Desktop.
Save msarsha/f29a37eaf9031b397761fe74af2650e2 to your computer and use it in GitHub Desktop.
export class MyComponent {
polling$ = interval(60000);
data$ = this.service.getData();
dataPolling$ = this.polling$.pipe(
switchMap(() => this.data$)
);
//Now you have two options, either .subscribe() in the constructor or use the async pipe
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment