好吧。我尝试在我的有角项目中使用Google地图。我安装该库并导入到我的模块中。像这样:
import { AgmCoreModule } from '@agm/core';
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
MatIconModule,
HttpClientModule,
BrowserAnimationsModule,
ToastrModule.forRoot(),
BlockUIModule.forRoot(),
NgxMaskModule.forRoot(),
AgmCoreModule.forRoot({
apiKey:'MY KEY HERE'
})
],
我有一个密钥,并在apiKey中使用。
还有我的HTML代码:
<co-menu></co-menu>
<div [ngClass]="open ? opened : closed">
<div class="row menu-area">
<mat-icon class="menu-icon" (click)="changeOpt()" >reorder</mat-icon>
</div>
<agm-map [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
</div>
但是我的Web控制台向我显示了此错误:
GET http://192.168.1.110:4200/%E2%80%9Dhttp://maps.googleapis.com/maps/api/js%22 404 (Not Found)
Refused to execute script from 'http://192.168.1.110:4200/%E2%80%9Dhttp://maps.googleapis.com/maps/api/js%22' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
出什么问题了?