标签: agm

无法让 Angular Google Map AGM 与 Angular 11 一起使用

我使用 npm 安装了 agm/core,如下所示:

npm install @agm/core
Run Code Online (Sandbox Code Playgroud)

显示以下警告:

npm WARN @agm/core@3.0.0-beta.0 requires a peer of @angular/common@^9.1.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @agm/core@3.0.0-beta.0 requires a peer of @angular/core@^9.1.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
Run Code Online (Sandbox Code Playgroud)

尽管如此,我还是继续按照如下文档将 AgmCoreModule 导入 AppModule:

AgmCoreModule.forRoot({
      apiKey: 'MY MAP KEY',
      libraries: ['places']
    })
Run Code Online (Sandbox Code Playgroud)

但是,当尝试使用ng serve为应用程序提供服务时,会出现以下错误:

Error: node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:50:41 - error TS2314: Generic type 'MapHandlerMap<T>' requires 1 type argument(s).
50     subscribeToMapEvent<N …
Run Code Online (Sandbox Code Playgroud)

angular-google-maps angular agm angular11

9
推荐指数
2
解决办法
5704
查看次数

agm/core 和 Angular/google-maps 对于谷歌地图有什么区别

在我的 Angular 应用程序中,我需要添加google map. 我遇到了两个库,不知道该使用哪一个

npm install @angular/google-maps
npm install @agm/core --save
Run Code Online (Sandbox Code Playgroud)

谁能告诉我哪一个是最新的并且易于开发,或者两者都是相同的。

我想开发这种类型的地图

  • 没有垂直线和水平线的地图
  • 我应该能够改变背景颜色
  • 当我缩放时,国家/地区应该显示城市
  • 我应该能够在特定位置显示圆圈

在此输入图像描述

google-maps angular agm

8
推荐指数
2
解决办法
5669
查看次数

如何修复 npm install 上的 Angular 13(对等)依赖错误?

我正在开发一个 Angular 组件库,自从更新到 Angular 13 以来,npm i @our/library@14.1.1-beta.1我们的库出现了一些错误:

npm ERR! While resolving: test-app@0.0.0
npm ERR! Found: @angular/common@13.2.7
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~13.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0" from @agm/core@1.1.0
npm ERR! node_modules/@agm/core
npm ERR!   peer @agm/core@"^1.1.0" from @our/library@14.1.1-beta.1
npm ERR!   node_modules/@our/library
npm ERR!     @our/library@"14.1.1-beta.1" from the root project
Run Code Online (Sandbox Code Playgroud)

所以在我看来,它@agm/core@1.1.0具有@angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0"与 不兼容的依赖项@angular/common@"~13.2.0"。那是对的吗?

我尝试将@angular/common@8.0.0 …

dependencies npm angular agm

7
推荐指数
1
解决办法
1万
查看次数