1
我調用了API併成功返回了數據。 但是對於那個JSON數據,我無法綁定視圖。 下面是HTML模板無法將JSON數據綁定到在Angular2 nativescript中查看
<StackLayout>
<Label [text]="users.BookingReferenceID"> </Label>
</StackLayout>
這是我app.component.ts
this._dataService.Search(id)
.subscribe((data) => this.users = JSON.stringify(data),
error => console.log(error),
() => {(
console.log('Data Retrieved successfully' + this.users))
});
這是數據從API
{"Collection":
[{"IsIndexData":false,
"DocumentNumber":"2300000002018",
"BookingReferenceID":"CID0EX",
"IssuingDate":"2016-11-04T00:00:00",
"Errors":null,"Information":null,
"Warnings":null}],
"Errors":null,
"Information":null,
"Warnings":null}
總是返回我會在得到了一個未定義請幫助我
我曾經嘗試這樣做......但還是即時得到此異常 –
在./AppComponent類錯誤由於:無法讀取屬性'BookingReferenceID'undefined –
@RajivKrishnaa'.subscribe((data)=> console.log(data)'記錄了什麼? – echonax