重用页面访问量之间的AngularJS模板相同的路线 [英] Reuse an AngularJS template between page views for the same route

查看:141
本文介绍了重用页面访问量之间的AngularJS模板相同的路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的创建连接到一个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\">角克模块重用地图实例,因​​此不存在内存泄漏的角谷歌 - 地图。

The angular-gm module reuses map instances so there is no memory leak. There is also angular-google-maps.

这篇关于重用页面访问量之间的AngularJS模板相同的路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆