重用页面访问量之间的AngularJS模板相同的路线访问量、路线、模板、页面

2023-09-14 00:17:06 作者:野尽风尘

我使用的创建连接到一个HTML元素在我的角度模板对象的第三方JS API。

I am using a third party JS API that creates an object attached to an html element on my angular template.

每个模板被加载时我想重用已创建对象并重新安装到正确的HTML元素。

Each time the template is loaded I want to reuse the object already created and reattach it to the correct html element.

在这个plunker 你可以看到问题的证明。这里有重现步骤。我真的AP preciate任何建议如何preserve页面加载的第一个对象。

In this plunker you can see the issue demonstrated. And here are the steps to reproduce. I really appreciate any suggests on how to preserve the first object between page loads.

先谢谢了。

问题说明

要理解这个问题:

Problem Description

To understand the problem:

  点击上面的查看地图链接。在map.html模板正确加载和地图所示。  这样的地图被改变移动在一个小地图或缩放  在地图页面水龙头显示主页链接返回到该页面。  现在,中,点击主页链接返回该页面  现在,中,点击查看地图第二次,你可以看到地图上被重建。

我想对于map.html模板重用这样的地图页面停留视图之间不变现有地图的对象。

I would like for the "map.html" template to reuse the existing map object so the map stays unchanged between page views.

推荐答案

这是一个不平凡的问题。

This is a non-trivial problem.

href=\"http://ngmodules.org/modules/angular-gm\" rel=\"nofollow\">角克模块重用地图实例,因​​此不存在内存泄漏的