I'm a beginner in Angular5 and I need your help...
I made an API in my backend (Java/Spring Boot) which I can access with http://localhost:8080/applications
With this API I want to retrieve a chunk of data (it's a JSON Array).
I try to retrieve data with httpClient on my Angular but I have this result in my frontend : [object Object]
This my app.component.ts
import {Component, Injectable} from '@angular/core'; import {HttpClient, HttpErrorResponse} from "@angular/common/http"; import {Observable} from "rxjs/Observable"; import 'rxjs/add/operator/map'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { url = 'http://localhost:8080/applications'; res = []; constructor(private http: HttpClient) { } ngOnInit(): void { this.http.get(this.url).subscribe(data => { this.res = data; console.log(data); }, (err: HttpErrorResponse) => { if (err.error instanceof Error) { console.log("Client-side error occured."); } else { console.log("Server-side error occured."); } }); } }
My Application interface Application.ts
interface Applications { id : number; type : string; port : string; baseUrl : string; architecture : string; protocol : string; serveur : string; }
How can I display my data ?
Thanks in advance