角UI路由器 - 如何preserve美景,一边交换意见路由器、美景、意见、UI

2023-09-14 00:16:36 作者:27.小懒找羊

我是我新的角度来和用户界面的路由器。

I am I new to Angular and UI Router.

普拉克 http://plnkr.co/edit / 1wfyrGryfGG5RtXozPFY?p = preVIEW

设置我有三个顶级应用程序的导航按钮主页,项目,帮助。它们装入不同的看法home.html做为,projects.html和help.html使用角UI界面路由器视图指令。这工作不错。

Setup I have three top level application nav buttons Home, Projects, Help. They load different views home.html, projects.html and help.html using the Angular UI Router ui-view directive. This works good.

该Projects.html视图都有对应一个项目中的每个选项卡标签栏:D1,D2 D3等,我给相应的项目选项卡使用URL路由属性

The Projects.html view has a tab bar with each tab corresponding to a project: D1, D2 D3 etc., I show the corresponding project tab using url router attributes.

我每次单击项目按钮,它完全重装了标签栏。我loswe当前选项卡,并希望如果它里面的任何嵌套意见。基本上Project.html的页面内容,调用该控制器为好。

Every time I click the Projects button it is reloading the tab bar completely. I loswe the current tab and hopefully if any nested views inside it. Basically the page contents of Project.html, invoking the controller as well.

我在维基文档中读取并且不可能找出如何实现我需要的功能。我相信,我失去了一些东西。它总是会重新加载看法?

I read through the wiki documents and couldnt figure out how to implement my required functionality. I am sure I am missing something. Will it always reload the view?

问:如何避免重装项目浏览内容,这样我可以保持所选选项卡和所有的内容,是切换到回家。因为我有很多的每个项目嵌套视图和模型。

Question: How to avoid reloading the projects view contents so that I can retain the selected tab and all the contents as-is before switching to Home. Because I would have a lot of nested views and models on each project.

推荐答案

我想类似的功能太多,但UI路由器尚不支持它。我分叉UI的路由器支持平行状态,并提交项目发表评论。谈话的要点是,UI路由器将最终支持某种形式的平行状态,但目前还没有。在此期间,你可以试试我的0.2.10提供所需的并行状态叉子。

I wanted similar functionality too, but ui-router doesn't yet support it. I forked ui-router to support "parallel states" and submitted it to the project for comment. The gist of the conversation is that ui-router will eventually support some form of parallel states but not yet. In the meantime, you can try my fork of 0.2.10 which provides the parallel states that you want.

在这里阅读的对话: https://github.com/angular-ui / UI路由器/问题/ 894

查看样品平行标签这里花掉: http://plnkr.co/edit / YhQyPV?p = preVIEW

View the sample parallel tabs plunk here: http://plnkr.co/edit/YhQyPV?p=preview

下面是叉;与咕噜构建它: https://github.com/christopherthielen/ui-router

Here is the fork; build it with grunt: https://github.com/christopherthielen/ui-router