Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'source.lift is not a function' error in angular?

I'm using a custom version of the angular project source.lift is not a function when the http get call is made. The error is in core.js file.

How to fix this issue?

enter image description here

like image 561
wonderful world Avatar asked Aug 22 '18 11:08

wonderful world


3 Answers

We had the same issue as well. In the end it turned out to be an issue with mismatched brackets. We used the switchMap operator and the catcherror operator. But because we had the brackets wrong. The catcherror operator was taken as the second parameter of the switchMap (the result selector) funnily enough, this still compiled though. So please double check your brackets.

like image 98
Nico Timmerman Avatar answered Oct 07 '22 06:10

Nico Timmerman


Got same problems. catchError should not be in tap brackets.

Wrong: catchError called in tap

  getHeroes() : Observable<Hero[]> {
    return this.http.get<Hero[]>(this.heroesUrl)
      .pipe(tap(_ => console.log('Fetching heroes'),
      catchError(this.handleError('getting heroes', []))  ))
  }

enter image description here

Correct is: (catchError not in tap)

  getHeroes() : Observable<Hero[]> {
    return this.http.get<Hero[]>(this.heroesUrl)
      .pipe(tap(_ => console.log('Fetching heroes')),
      catchError(this.handleError('getting heroes', [])  ))
  }
like image 27
Witold Kaczurba Avatar answered Oct 07 '22 04:10

Witold Kaczurba


I had the same error in my web app, i didn't get it fixed until i realized to test upgrading the rxjs version, since i had it at 6.0.0, changing it to the last at this moment, version 6.3.2 fixed my problem. In conclusion is a bug from first version of rxjs, we should test it a little more, but so far so good. Hope this helps you.

like image 6
Alejandro Avatar answered Oct 07 '22 05:10

Alejandro