【问题标题】:AngularJS Custom Google Maps directive with error: 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.`AngularJS自定义谷歌地图指令错误:'窗口'上的'getComputedStyle':参数1不是'元素'类型。`
【发布时间】:2015-08-28 22:55:53
【问题描述】:

我想在 AngularJS 中创建一个根据位置显示 Google 地图的简单指令。

我收到此错误:Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

我创建了下一个 plunker 来重现该问题:http://plnkr.co/edit/Fnmanw1sjblKTJNmYGaV?p=preview

【问题讨论】:

  • 通常建议在 SO 上也包含代码,以防代码的外部引用不再可用

标签: angularjs google-maps


【解决方案1】:

改变这个:

var map = new google.maps.Map(element, mapOptions);  

到这里:

var map = new google.maps.Map(element[0], mapOptions);   

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-11
    • 2022-06-23
    • 2017-12-27
    • 1970-01-01
    • 1970-01-01
    • 2013-09-23
    • 2013-05-20
    相关资源
    最近更新 更多