Angular-google-maps: 将 dragEnd 事件添加到 agm

创建于 2017-10-03  ·  3评论  ·  资料来源: SebastianM/angular-google-maps

大家好,
我按照这个例子添加事件https://github.com/SebastianM/angular-google-maps/pull/1159/files
但仍然没有出现变化。 我如何重建包含更改的项目?

stale

最有用的评论

@matishw你可以从我的个人资料中克隆repo并使用 npm/yarn 来构建它,尽管我建议你等待这个 PR 被合并。 同时,您可以使用此解决方法:

@ViewChild(AgmMap) map: any;
private dragEndSubscription: Subscription;

ngOnInit() {
  this.dragEndSubscription = (this.map._mapsWrapper as GoogleMapsAPIWrapper) 
    .subscribeToMapEvent('dragend')
    .subscribe(() => // Your logic goes here);
}

ngOnDestroy() {
  this.dragEndSubscription.unsubscribe();
}

所有3条评论

@matishw你明白了吗? 我也将向标记添加更多事件,所以我对此很感兴趣。

@matishw你可以从我的个人资料中克隆repo并使用 npm/yarn 来构建它,尽管我建议你等待这个 PR 被合并。 同时,您可以使用此解决方法:

@ViewChild(AgmMap) map: any;
private dragEndSubscription: Subscription;

ngOnInit() {
  this.dragEndSubscription = (this.map._mapsWrapper as GoogleMapsAPIWrapper) 
    .subscribeToMapEvent('dragend')
    .subscribe(() => // Your logic goes here);
}

ngOnDestroy() {
  this.dragEndSubscription.unsubscribe();
}

此问题已自动标记为过时,因为它最近没有活动。 如果没有进一步的活动,它将被关闭。 感谢你的贡献。

此页面是否有帮助?
0 / 5 - 0 等级