내가 Angular5에서 초보자 그리고 난 당신의 도움이 필요 ... http://localhost:8080/applications
표시 JSON 배열 5 HttpClient를 내가에 액세스 할 수 있습니다 내 백엔드 (자바/봄 부팅)에서 API를 만든</p> <p>
이 API를 사용하여 데이터 덩어리 (JSON Array)를 가져와야합니다. Json image
내가 내 각도에 세션 객체와 데이터를 검색하려고하지만 난 내 프론트 엔드에서이 결과를 가지고 : [개체 개체]
이 내 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."); } }); } }
내 응용 프로그램 인터페이스 응용 프로그램 .ts
interface Applications { id : number; type : string; port : string; baseUrl : string; architecture : string; protocol : string; serveur : string; }
데이터를 표시하려면 어떻게해야합니까? 충분히