How to import rxjs timer in angular 6?

anonymous

I tried importing rxjs timer on my angular 6 project like

import { timer } from 'rxjs/observable/timer';

I also tried it like,

Rx.Observable.timer(200, 100)

They don't work

Here is the code on plunker

ashfaq.p

From rxjs 6 (as used in angular 6 project), The general rule is as follows:

  • rxjs: Creation methods, types, schedulers and utilities

    import { timer, Observable, Subject, asapScheduler, pipe, of, from,
             interval, merge, fromEvent } from 'rxjs';
    
  • rxjs/operators: All pipeable operators:

    import { map, filter, scan } from 'rxjs/operators';
    

Here is the migration guide: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#observable-classes

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related