After upgrading to angular6 fews problem while using rxjs
import {
Observable,
Subject,
asapScheduler,
pipe,
of,
from,
interval,
merge,
fromEvent
} from "rxjs";
import { delay } from "rxjs/operators";
let obser = from([ 1, 2, 3 ]).delay( 3000 );
Getting Property 'delay' does not exist on type 'Observable'
on angular 5 this works fine
import { Observable } from 'rxjs/Observable';
let obser = Observable.from([ 1, 2, 3 ]).delay(3000);
Angular 6 comes with rxjs 6 which have some differencies. In rxjs 6 you chain operators via pipe:
let obser = from([ 1, 2, 3 ])
.pipe(
delay( 3000 )
);
I am in angular 9 and still 'delay' is not resolved in rxjs 6.*.
import { delay } from 'delay from rxjs/internal/operators';
Here is a quick example code using delay in a mock service:
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/internal/operators';
@Injectable()
export class AppService {
fetchData(): Observable<string> {
return of('Todo')
.pipe (
delay( 1000 )
);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With