javascript - 什么是 TypeScript 中用于读取/获取数据的 *NgFor
问题描述
当我单击按钮时,我尝试在 TypeScript 中获取/显示数据。但我只能显示一次数据。我开始了,我不明白所有的事情。(对不起我的英语)
我已经尝试过使用 forEach,但只能使用一次。
async spotAdded() {
this.spots = this.spotService.getSpots(); // i get my data from here
this.spots.forEach(info => {
info.forEach(infos => {
console.log(infos);
const marker: Marker = this.map.addMarkerSync({
position: {
lat: infos.lat,
lng: infos.lng
},
title: infos.description,
snippet: infos.user,
disableAutoPan: true
});
marker.showInfoWindow();
});
});
}
我实际上有这个,但对于数据库中的每个点只有一次(我使用 firebase):
{id:“NbtJraND8XhSDUG8rlRY”,createdAt:1559308376871,描述:“Quatre”,flat:false,lat:48.996672,...}
解决方案
推荐阅读
- ignite - Ignite SQL 线程池查询示例
- javascript - 如何使用javascript通过当前复选框动态更改默认复选框?
- airflow - Apache 气流 SLA 未命中 - 不发送电子邮件
- tinylog - 使用 TinyLog 时出现 Writer 错误
- c# - C# 审查中的 JSON Web Token 漏洞测试
- html - CSS 媒体查询,忽略移动设备上的属性
- python - 根据标签查找属于一起的字符串
- javascript - 多日日历 Datepicker JQuery 插件
- javascript - 当我在参数中传递另一件事时意外使用事件
- c# - 如何从单个命令中获取多个 Redis 列表