I was recently using observable on my authentication token like
Observable.of('token');
But it keeps giving me above mentioned error, though i have already imported this.
import {Observable} from 'rxjs/Observable';
I was recently using observable on my authentication token like
Observable.of('token');
But it keeps giving me above mentioned error, though i have already imported this.
import {Observable} from 'rxjs/Observable';
You need to import it:
for Angular >= 6.0.0
uses RxJS 6.0.0 Angular Changelog 6.0.0
import { of } from 'rxjs';
And its usage has been changed, you no longer call it off of Observable:
of('token');
RxJS v5.x to v6 Update Guide - HowTo: Convert to pipe syntax which uses of()
for Angular <= 5.x.xx
import 'rxjs/add/observable/of';
And it's used as you have in your question
Observable.of('token');
import 'rxjs/add/observable/of';
–
Whitcher import { of } from 'rxjs';
and of('token');
now. See answers in the linked duplicate-of-question. –
Zombie © 2022 - 2024 — McMap. All rights reserved.