1
のためのオブジェクトをサポートしている異なるがclient.service.ts2:ここでは* ngFor
clients: Client[];
getClientList()
{
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let authToken = localStorage.getItem('auth_token');
console.log(authToken);
headers.append('X-auth-Token', authToken)
return this._http.get('http://localhost:8080/api/v1/client/list?isClient=Y', {headers})
.map((data: Response) => {
this.clients= JSON.parse(data['_body']);
return this.clients;
})
}
で見つけることができません私はクライアントのためにモデルを作成しました。私はこの問題を解決することができないlot.butを検索しました
[{"userId":"cos.com","clientCode":"75","clientName":"Abc COMPANY, THE"},{"userId":"maintenance.com","clientCode":"51","clientName":"AINC./ ALSTYLE APPAREL"}]
:
HomeComponent.ts
onTestGet()
{
this._httpService.getClientList()
.subscribe(
data => this.getData = JSON.stringify(data),
error => alert(error),
() => console.log("finished")
);
}
home.html
<select class="borderdiv" #select [(ngModel)]="cuurent" (change)="onChange($event.target.value)" class="form-control input-group" *ngIf="radioValue == 'yes'">
<option *ngFor="let client of getData"> {{client.clientName}} </option>
</select>
レスポンスデータ。私を助けてください。
明らか 'getData'あなたは'レスポンスdata'として表示配列を返すされていないする必要があります。試してみてください
' getClientList() 'のコードを投稿してください –
私は{{getData | json}}、htmlで応答を取得 –