Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - "has no exported member 'Observable'"

People also ask

Which has no exported member model?

The error "Module has no exported member" occurs when we try to import a member that doesn't exist in the specified module. To solve the error, make sure the module exports the specific member and you haven't mistyped the name or mistaken named for default import.

What was not found in RXJS?

To solve the error "Module not found: Error: Can't resolve 'rxjs'", make sure to install the rxjs package by opening your terminal in your project's root directory and running the command npm install rxjs and restart your development server.

What is of operator in RXJS?

The of Operator is a creation Operator. Creation Operators are functions that create an Observable stream from a source. The of Operator will create an Observable that emits a variable amount of values in sequence, followed by a Completion notification.


This might be helpful in Angular 6 for more info refer this Document

  1. rxjs: Creation methods, types, schedulers and utilities
import { Observable, Subject, asapScheduler, pipe, of, from, interval, merge, fromEvent } from 'rxjs';
  1. rxjs/operators: All pipeable operators:
import { map, filter, scan } from 'rxjs/operators';
  1. rxjs/webSocket: The web socket subject implementation
import { webSocket } from 'rxjs/webSocket';
  1. rxjs/ajax: The Rx ajax implementation
import { ajax } from 'rxjs/ajax';
  1. rxjs/testing: The testing utilities
import { TestScheduler } from 'rxjs/testing';

Apparently (as you point in the error log), after updating to Angular 6.0.0 rxjs-compat is missing.

Run npm install rxjs-compat --save to install. Should fix it.


Just put:

import { Observable} from 'rxjs';

Just like that. Nothing more or less.


I replaced the original code with import { Observable, of } from 'rxjs', and the problem is solved.

enter image description here

enter image description here


You are using RxJS 6. Just replace

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';

by

import { Observable, of } from 'rxjs';

Try this:

npm install rxjs-compat --save