简体   繁体   English

如何在angular js路由中保留模板视图

[英]how to retain the template view in angular js routing

I am writing a web app similar to dropbox and gdrive, i fetch ids of file based on that it will be able to navigate from page to page, folder to folder, eg /abc to abc/abc... All i need to do it from client side. 我正在写一个类似于Dropbox和GDrive的Web应用程序,我基于此文件ID来获取文件ID,它将能够从页面导航到页面,从文件夹导航到文件夹,例如/ abc到abc / abc ...所有我需要做的从客户端。 I made it simple using AngularJS Routing(ui-router). 我使用AngularJS Routing(ui-router)使其变得简单。 Here is my code 这是我的代码

$stateProvider.state('dashboard.sync.root', {
  url: "/*path",
    templateUrl: "root.html",})
here user can navigate like http://myweb/dashboard/sync/root/abc or http://myweb/dashboard/sync/root/abc/.../../ 

while traversing from page to page the root.html(template) goes on changing. 在页面之间遍历时,root.html(template)会不断变化。 Problem here is when I traverse back and forth, it doesnt store previous view. 这里的问题是当我来回移动时,它不存储以前的视图。 when i click back and forward button in browser. 当我在浏览器中单击后退和前进按钮时。 Any Solution Appreciated 任何解决方案

You can use 3 different files to maintain your app: 您可以使用3个不同的文件来维护您的应用程序:

header.html
body.html
footer.html

And use ng-view in body to include using your routes. 并在正文中使用ng-view包括使用路线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM