我在 angular 2 的 ngx-leaflet 组件方面有问题。在将 *ngif 的状态从 true 更改为 false 并在地图出现时再次从 false 更改为 true 后,没有发生图块渲染。我该怎么做才能避免这个问题?
<button (click)="showMap=!showMap">toggle</button>
<div *ngif="showMap">
<div [style.height.px]="mapHeight" leaflet
(leafletClick)="mapOnClick($event)"
[(leafletCenter)]="mapCenter"
[leafletOptions]="options"
(leafletMapReady)="onMapReady($event)"
[leafletLayers]="layers">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
options = {
layers: [
tileLayer('http://tile.openstreetmap.org/...',
{ maxZoom: 18, attribution: '...' })
],
zoom: 12,
center: latLng(35.679966, 51.4)
};
map = null;
onMapReady(map: Map) {
this.map = map;
}
mapOnClick(evt) {
}
Run Code Online (Sandbox Code Playgroud) 我是VertX框架的新手(也是反应式编程)。当我读到“ Future”时,我不明白“ completer”方法的用途是什么,什么时候必须使用它?如果有人可以帮助我,我将不胜感激。