google-maps - 打字稿错误找不到名称'google'
问题描述
如果我将文件保存两次,但不知道为什么 google.maps.ts
ngOnInit(){
this.initMap();
}
initMap(){
let coords = new google.maps.LatLng(37.992667,-1.1146491);
let mapOptions: google.maps.MapOtpions= {
center: coords,
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(this.mapElement.nativeElement,
mapOptions)
}
}
这是错误代码...
Typescript: C:/ionic/restaurante/IESAljada/src/components/google-map/google-map.ts, line: 22
L21: initMap(){
L22: let coords = new google.maps.LatLng(37.992667,-1.1146491);
L23: let mapOptions: google.maps.MapOtpions= {
解决方案
google.maps.MapOtpions
看起来像一个错字。你的意思是google.maps.MapOptions
?
推荐阅读
- html - 如何将数据从html表单元素传递到角度类
- python - 试图让 midi2vjoy 工作,pygame.midi.Input 导致分段错误
- algorithm - 查找列表中另一个数字的超集的数字
- java - 我被困在我的 android 应用程序之一的“If”和“Else”功能中
- c++ - 引用指向 const 作为函数参数的指针
- jmeter - JMeter - 在运行时测试未在第二次调用时运行
- r - 在ggplot中添加空格/增加X和Y轴之间的空间
- extjs - 无法在应用程序中更改当前的 extjs 主题
- javascript - 使用 ajax 获取和更新数据
- pandas - 熊猫读取带有日期时间段的 csv