Typescript angular2如何打印对象数组的值
我想打印数组的值=>Typescript angular2如何打印对象数组的值,typescript,angular,Typescript,Angular,我想打印数组的值=>id,如下所示: locations = [ {id: '1', lat: 51.5239935252832, lng: 5.137663903579778, content: 'Kids Jungalow (5p)'}, {id: '2', lat: 51.523853342911906, lng: 5.1377765563584035, content: 'Kids Jungalow (5p)'}, {id: '3', la
id
,如下所示:
locations = [
{id: '1', lat: 51.5239935252832, lng: 5.137663903579778, content: 'Kids Jungalow (5p)'},
{id: '2', lat: 51.523853342911906, lng: 5.1377765563584035, content: 'Kids Jungalow (5p)'},
{id: '3', lat: 51.5237298485607, lng: 5.137969675407476, content: 'Kids Jungalow (5p)'},
{id: '4', lat: 51.52355628836575, lng: 5.138066234932012, content: 'Kids Jungalow (5p)'},
{id: '5', lat: 51.52340275379578, lng: 5.138211074218816, content: 'Kids Jungalow (5p)'},
{id: '6', lat: 51.523199152806626, lng: 5.138382735595769, content: 'Kids Jungalow (5p)'},
{id: '7', lat: 51.5229955509073, lng: 5.138511481628484, content: 'Kids Jungalow (5p)'},
];
在我的html模板中,我写了这样的内容:{{{locations.id}
但是它没有显示出什么问题?//检查您是否正在创建局部变量位置
<h1 *ngFor="#location of locations">**{{location.id}}**</h1>
**{location.id}**
//检查是否正在创建局部变量位置
<h1 *ngFor="#location of locations">**{{location.id}}**</h1>
**{location.id}**