這是我的json響應。如何能在角2在角度2中綁定ngModel中的json值
[
{
"id": 18,
"gname": "learning ramayanam",
"goalCategory": "Education",
"goalSubCategory": "short-term",
"goalDesc": "good",
"rowStatusCode": "D",
"createID": "1",
"createTS": null,
"updateID": "Ram",
"updateTS": null,
"rewards": {
"rewardID": 1,
"rewardName": "Laptop"
}
]
在[(ngModel)]
的rewards.rewardName值綁定這是我的代碼哥們我怎麼能值綁定在ngModel
ngOnInit() {
this.route.params
.forEach(params => {
this.isEdition = !!params['id'];
if (this.isEdition) {
// this.getDocument(params['id']);
this.itemPromise = this.http.get('http://localhost:8080/dy/get-goal?id='
+
params['id'])
.map(res => res.json()).toPromise();
this.itemPromise.then((item: any) => {
console.log(item);
var arr = JSON.parse(item);
this.item = arr[0];
return item;
});
非常感謝我的工作 –
沒問題,很高興我能幫幫我 :) – Alex