angular - 使用从 angular-google-maps agmCircle 到打字稿文件的方法
问题描述
我想在改变时得到一个圆的边界。从这里https://angular-maps.com/api-docs/agm-core/directives/AgmCircle.html我可以看到它有一个“getBounds”方法,我如何从我的打字稿文件访问它来记录这些数据?目前我的 html 圆圈组件如下所示:
<agm-circle [latitude]="lat + 0.3" [longitude]="lng"
[radius]="10000"
[fillColor]="'blue'"
[circleDraggable]="true"
[editable]="true"
(dragEnd)="test($event)"
>
</agm-circle>
我希望有这样的功能:
test(m){
// get bounds from circle in some way
}
解决方案
只需将其作为 a 添加ViewChild
到您的组件中
@ViewChild(AgmCircle) child;
test(m) {
console.log(this.child.getBounds())
}
推荐阅读
- asp.net - 如何使用 Visual Basic 中的 excel 数据阅读器获取特定单元格的内容?使用 Excel 数据阅读器
- c - 在 C 中将 double 转换为 char*
- lambda - 使用 lambda 函数数值求解方程
- reactjs - React - 关闭严格模式,仅在第一次状态更改后第二次构造功能组件
- php - 显示来自 2 个表 laravel 6 的数据
- tomcat - 在没有 web.xml 的情况下覆盖 Tomcat 的默认错误页面
- python - Pytorch LSTM-VAE Sentence Generator:RuntimeError:梯度计算所需的变量之一已被就地操作修改
- c# - 如何在我的 Xamarin 应用程序中使用 NavigationPageRenderer 来自定义顶部导航栏?
- pandas - 塞恩斯伯里的美味汤一无所获
- javascript - 将额外的属性从 CKFinder 发送到 CKEditor 5