1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

TS2339:(TS) Property 'catch' does not exist on type 'Observable<Object>'

Discussão em 'Angular' iniciado por Umesh Chand Yadav, Agosto 12, 2025.

  1. My code which I tried to implement, it shows 'catch' does not exist:

    import { Injectable } from '@angular/core';
    import { HttpClient, HttpHeaders } from '@angular/common/http';
    import { Observable } from 'rxjs';
    import { User } from '../Model/User';
    import { environment } from '../../environments/environment';
    import 'rxjs/add/operator/catch';

    @Injectable()
    export class UserService {
    headers: HttpHeaders;
    constructor(private httpClient: HttpClient) {
    this.headers = new HttpHeaders({ 'content-type': 'application/json' });
    }
    GetUser(): Observable<User[]> {
    return this.httpClient.get(environment.apiAddress + '/user').catch(err => Observable.throw(err));
    }
    }

    Continue reading...

Compartilhe esta Página