无法读取未定义的 属性 'lng'
Cannot read property 'lng' of undefined
我使用 ng-map.min.js
在 google 地图中使用客户标记
我正在更改自定义标记的位置,但显示以下错误:
Uncaught TypeError: Cannot read property 'lng' of undefined
at a.setPosition (ng-map.min.js:25)
at a.draw (ng-map.min.js:25)
at a.Mz (overlay.js:1)
at js?key=xxx&callback=lazyLoadCallback:138
The code i write for custom marker is :
in html file :
==============
<custom-marker ng-repeat="p in page.watchpath track by $index" position="{{p.Location.position}}">
<div>
<img src="{{p.ImagePath ? page.serviceBasePath + p.ImagePath.substr(2) : page.serviceBasePath + 'Images/avatar.jpg'}}" style="border-radius: 50%; height:40px;width:40px;" />
</div>
</custom-marker>
in js file :
============
page.watchpath[deviceindex] = { position: device.Location.position, ImagePath: imagePath };
But When i am using for marker tag it is not showing any error :
<marker ng-repeat="p in page.watchpath track by $index" position="{{p.position}}"></marker>
When i am using for custom-marker tag it showing error message
How to rectify this error ?
Please help me ...?
您的代码中的以下功能 returns 是什么?
device.Location.position
您在视图中传递的模型 (p.position) 应该是一维数组:
p.position = [0,0]
第一个索引是 'lat' 第二个是 'lng.
我使用 ng-map.min.js
在 google 地图中使用客户标记我正在更改自定义标记的位置,但显示以下错误:
Uncaught TypeError: Cannot read property 'lng' of undefined
at a.setPosition (ng-map.min.js:25)
at a.draw (ng-map.min.js:25)
at a.Mz (overlay.js:1)
at js?key=xxx&callback=lazyLoadCallback:138
The code i write for custom marker is :
in html file :
==============
<custom-marker ng-repeat="p in page.watchpath track by $index" position="{{p.Location.position}}">
<div>
<img src="{{p.ImagePath ? page.serviceBasePath + p.ImagePath.substr(2) : page.serviceBasePath + 'Images/avatar.jpg'}}" style="border-radius: 50%; height:40px;width:40px;" />
</div>
</custom-marker>
in js file :
============
page.watchpath[deviceindex] = { position: device.Location.position, ImagePath: imagePath };
But When i am using for marker tag it is not showing any error :
<marker ng-repeat="p in page.watchpath track by $index" position="{{p.position}}"></marker>
When i am using for custom-marker tag it showing error message
How to rectify this error ?
Please help me ...?
您的代码中的以下功能 returns 是什么?
device.Location.position
您在视图中传递的模型 (p.position) 应该是一维数组:
p.position = [0,0]
第一个索引是 'lat' 第二个是 'lng.