Angular 6: Property 'of' does not exist on type 'typeof Observable'
Since RxJS 6 the correct and recommended way of using of()
(RxJS 5 in Observable.of()
) is this:
import { of } from 'rxjs';
I think this import { of } from 'rxjs/observable/of';
will work only while you have rxjs-compat
package installed.
There are some updates in rxjs: ( Its rxjs6)
import { of } from 'rxjs';
It will work only when your app has rxjs-compat
package installed
You can import of
from rxjs
:
import { Observable,of } from 'rxjs';
And simply return of()
return of({
lbl_select: 'Select',
});
So your code will be:
import { Injectable } from '@angular/core';
import { TranslateLoader } from '@ngx-translate/core';
import { Observable, of } from 'rxjs';
@Injectable()
export class MiTranslateLoaderService implements TranslateLoader {
getTranslation(lang: string): Observable<any> {
return of({
lbl_select: 'Select',
});
}
}