rea*_*lph 5 javascript angularjs angular-google-maps
我正在使用angularjs-google-maps,并且在尝试将我的客户作为地图上的标记循环时收到错误.
<map>
<custom-marker ng-repeat="cust in customers" position="[ {{ cust.lat }}, {{ cust.lon }} ]">
<div class="{{ cust.category }}">{{ cust.name }}</div>
</custom-marker>
</map>
Run Code Online (Sandbox Code Playgroud)
该错误似乎有事情做与cust.category和cust.name,当我删除这些,他们工作得很好.
这是我得到的错误消息的前几行:
Watchers fired in the last 5 iterations: [["[ cust.category , cust.name ]; newVal:
[\"pro\",\"Fred\"]; oldVal: [\"pro\",\"Fred\"]","fn: function (context) {\n
try {\n for(var i = 0, ii = length, part; i<ii; i++) {\n
Run Code Online (Sandbox Code Playgroud)
完整的错误消息在这里.
对此有任何帮助表示赞赏.提前致谢!
UPDATE
代号为定制标记指令,是角谷歌,地图的一部分,是在这里.
看起来摘要循环陷入了循环。Angular 有一个摘要周期,它们会观察模型(无论 $scope 上的内容),并在模型发生变化时将更改应用于视图。如果在摘要周期中您正在执行某个再次更改值的函数,则会触发另一个摘要周期,该摘要周期会再次触发相同的函数,更改模型上的值并触发摘要周期的无限循环。
也就是说,您可能需要添加 customMarker 指令的代码以使答案更加精确。
| 归档时间: |
|
| 查看次数: |
1580 次 |
| 最近记录: |