TypeError: rxjs__WEBPACK_IMPORTED_MODULE_2__.Observable.throw is not a function

Jitendra Ahuja

Here is my file userdata.service.ts :

import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import {Observable} from 'rxjs';
import { map } from "rxjs/operators";
import { catchError } from 'rxjs/operators';
import { Data } from './userdata';

@Injectable()
export class UserDataService {

  url : "http://localhost:4200/assets/data/userdata.json";
  constructor(private http:Http) { }  

  getDataWithObservable() : Observable<any>{
      return this.http.get(this.url)
            .pipe(
              map(this.extractData),
              catchError(this.handleErrorObservable)
            );
  }

    private extractData(res: Response) 
    {
        let body = res.json();      
        return body;
    }

    private handleErrorObservable (error: Response | any) 
    {   
        return Observable.throw(error.message || error);
    }
}

I m getting the following Error :

TypeError: rxjs__WEBPACK_IMPORTED_MODULE_2__.Observable.throw is not a function

Chris Fremgen

Import:

import { throwError } from 'rxjs';

Usage:

return throwError(err);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

rxjs__WEBPACK_IMPORTED_MODULE_3__.Observable.throw is not a function at

rxjs__WEBPACK_IMPORTED_MODULE_1__.Observable.throw is not a function

Angular - rxjs_Observable__WEBPACK_IMPORTED_MODULE_2__.Observable.of is not a function

Angular Universal RxJs "Observable_1.Observable.throw is not a function"

"rxjs" observable.throw is not a function - Angular4

TypeError: _rxjs.Observable.fromPromise is not a function

TypeError: Webpack imported module is not a function

throw error inside rxjs Observable

TypeError: .json WEBPACK_IMPORTED_MODULE_2__.filter is not a function

TypeError: _firebase__WEBPACK_IMPORTED_MODULE_2__.default.collection is not a function

TypeError: __WEBPACK_IMPORTED_MODULE_3__ is not a function

RXJS 6.3.3 Ionic TypeError: Observable.combineLatest is not a function

TypeError Observable.concat is not a function

RxJS "throw new Error" vs "Observable.throw"

Observable.throw replacement in rxjs 5.5.2

Webpack compile error: TypeError: __WEBPACK_IMPORTED_MODULE_1__ … is not a function

Module not found: Error: Can't resolve 'rxjs/add/observable/throw'

Angular2 Http with RXJS Observable TypeError: this.http.get(...).map(...).catch is not a function

TypeError: Observable_1.Observable.fromEvent is not a function in ng2-bs3-modal/ng2-bs3-modal module

TypeError: jquery__WEBPACK_IMPORTED_MODULE_1___default(...)(...).select2 is not a function

TypeError: react__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function. How do I solve this?

Uncaught TypeError: (0 , react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useHistory) is not a function (React.js)

TypeError: _firebase_config__WEBPACK_IMPORTED_MODULE_2__.default.auth is not a function

TypeError: _initFirebase__WEBPACK_IMPORTED_MODULE_4__.firebase.database is not a function

TypeError: __WEBPACK_IMPORTED_MODULE_0_react___default.a.createRef is not a function

ERROR TypeError: __WEBPACK_IMPORTED_MODULE_5_jquery__(...).tagsinput is not a function

TypeError: react__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

TypeError: _fire__WEBPACK_IMPORTED_MODULE_1__.default.auth is not a function

TypeError: _firebase__WEBPACK_IMPORTED_MODULE_1__.default.collection is not a function