ngAnimate和ngRoute之间存在奇怪的冲突

时间:2014-10-29 15:28:52

标签: angularjs leaflet ng-animate ngroute

我注意到ngAnimate和ngRoute之间存在一个非常奇怪的错误(或者我做错了)。如果我尝试重新加载当前路线而不重新加载整页,出现问题,我无法重新初始化我的传单地图。我创建了一个plunker来演示这种行为。

如果我/你没有加载ngAnimate模块,一切都按计划进行。我做错了什么还是错误/功能?

干杯, 丹尼尔

1 个答案:

答案 0 :(得分:0)

似乎传单初始化了Map容器​​,尽管它已经初始化(从控制台中取出):

Error: Map container is already initialized.
at o.Map.o.Class.extend._initContainer (http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js:6:25685)
at o.Map.o.Class.extend.initialize (http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js:6:19036)
at new o.Class.extend.e (http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js:6:2539)
at Object.o.map (http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js:6:31439)
at new <anonymous> (http://run.plnkr.co/XI7Vl2hTc4EgnNEf/script.js:27:24)
at invoke (https://code.angularjs.org/1.3.0/angular.js:4152:17)
at Object.instantiate (https://code.angularjs.org/1.3.0/angular.js:4163:23)
at https://code.angularjs.org/1.3.0/angular.js:8350:28
at link (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js:910:26)
at invokeLinkFn (https://code.angularjs.org/1.3.0/angular.js:8111:9) <div ng-view="" class="ng-scope"> 

这导致angularjs停止。尝试此解决方案: refresh leaflet map: map container is alreay initialized

我认为在您的情况下,最好删除容器,然后再次添加:)