vendredi 21 juin 2019

I can not bind json to typscript type

Good night,

when I do a get consuming a rest service, the response comes with the correct json but does not bind.

getObjetoById(idObjeto: Number): Observable<Objeto> {
    const url_datas = "http://localhost:4200/api/method/Objeto" + '/' +idObjeto;
    return this.http.get<Objeto>(url_datas).pipe(
      catchError(this.handleError)
    );
  }

...
    this.servico.getObjetoById("1").subscribe(
      (data: Objeto) => this.objeto = data,
      error => console.log(error)
    );
console.log("valor da variavel "+variavel);

Follow versions of angular and typescript

$ ng -v Your global Angular CLI version (7.3.8) is greater than your local version (6.2.5). The local Angular CLI version is used.

$ tsc -v Version 3.4.5




Aucun commentaire:

Enregistrer un commentaire