Я получаю ответ JSON, как показано ниже,
{
"Meta Data" : {
"ticker" : "NEE",
"datapoints" : 320,
"credit cost" : 320,
"Time Zone" : "America/New_York",
"last refreshed" : "06/17/2019 at 09:27AM ET"
},
"Realtime Stock price" : [ {
"ticker" : "NEE",
"date" : "20190614",
"minute" : "15:58:01",
"volume" : 1028861,
"price" : 207.02,
"timezone" : "EDT",
"timezone_name" : "America/New_York",
"gmt_offset" : -14400
}, {
"ticker" : "NEE",
"date" : "20190614",
"minute" : "15:57:00",
"volume" : 996057,
"price" : 207.14,
"timezone" : "EDT",
"timezone_name" : "America/New_York",
"gmt_offset" : -14400
}]}
Это мой код,
allPrice: Array<object> = [];
getShareData(){
this.dataservice.getSharePrice().subscribe(data=>{
this.allPrice=data['Realtime Stock pric'];
console.log("Show Price"+JSON.stringify(this.allPrice[1]));
})
}
Но я не получаю цену в моем шаблоне. Я тоже путешествую с картой
this.allPrice=data['Realtime Stock pric'].map(d=>d.price);
Но это тоже не работает.
Что я могу сделать? Пожалуйста, предложите