I can't show data in HTML from my API response because type of response is an Object and I couldn't convert to Array.
This is the response from API:
This is my service that works doing HTTP request to my API
url: string = 'http://localhost:3000/aduanas/'
constructor(public aduanas: AduanasService, private http: HttpClient) { }
// getInfo(){
// console.log();
// }
getInfoAduanas():Observable<Aduanas>{
return this.http.get<Aduanas>(`${this.url}${this.id.value}`)
}
}
This is my interface:
export interface Aduanas {
id: number;
estado: string;
nombre: string;
telefono: string;
horario_sem: string;
horario_fin: string;
direccion: string;
tipo: string;
agentes: string;
}
This is my component where I subscribe it
customList:Aduanas;
id = this.aduanas.markerId;
constructor(private modalController: ModalController, public aduanas: AduanasService, public api: ApiService) { }
ngOnInit() {
this.api.getInfoAduanas().subscribe( data => {
this.customList = data;
console.log(this.customList);
});
}
I get this error:
And this is my HTML component: