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

method does not exist on type service

Discussão em 'Angular' iniciado por Annie Vi, Setembro 17, 2024.

  1. Annie Vi

    Annie Vi Guest

    i am building a service to retrieve some entries from db.json json server. I've implemented the getAll service method and injecting into component but when trying to call the method of service i get a method does not exist on type TeamService: here's my code: `export class TeamService { private apiUrl= 'http://localhost:3000/team';

    constructor(private http : HttpClient) {}

    getAllTeam(): Observable<Team[]>{
    return this.http.get<Team[]>(this.apiUrl);
    }
    }

    //method on component call:

    loadTeam():void{
    this.teamServices.getAllTeam().subscribe((team) => {
    this.team = team;
    console.log(this.team);
    })
    }
    `


    I wanted all the entries to be loaded and console logged

    Continue reading...

Compartilhe esta Página