【发布时间】:2019-03-18 11:00:11
【问题描述】:
我有以下来自 api 的响应
[
{
"Cinema_strName": "Cll, Kollam",
"Cinema_strID": "CEWB",
"Cinema_strBannerImg": "",
"cinema_addr": "5th Kollam",
"cinema_loc": "<iframe src=\"https://www9550314\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>",
"cinema_mob": 0
},
{
"Cinema_strName": "Cs, Kollam",
"Cinema_strID": "KEWB",
"Cinema_strBannerImg": "",
"cinema_addr": "Carlangara, Kollam, Kerala - 691581",
"cinema_loc": "<iframe src=\"hsen!2sin49\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>",
"cinema_mob": 0
}
]
我想从 api 中获取cinema_loc,因为我正在执行以下代码
this.common.createAPIService('api/cinemas/List?CityName='+city, '').subscribe((result: any) => {
if(result.length){
this.cinema = result;
this.loc = this.cinema.cinema_loc;
console.log(this.loc);
}else{
alert('Cinema not found');
}
})
但它给了我未定义的价值。如果我写this.cinema[0].cinema_loc。我只会得到第一个响应 iframe。请帮忙。
对于@nikhil
<div class="col-md-9">
<div class="map" *ngFor="let map of html">
<div [innerHTML]="map"></div>
</div>
</div>
【问题讨论】:
-
你想如何读取/处理cinema_loc?
-
我想在 html 中添加 iframe
-
您想要一个特定的cinema_loc 还是在模板中的iframe 中显示所有这些?
-
响应中的所有 iframe
标签: javascript angular angular5 ngfor