简体   繁体   English

AngularJS路由到多个起始页

[英]AngularJS Routing to Multiple Start Pages

I am trying to make an app where I have a home page, and a dashboard that has a separate route. 我正在尝试制作一个具有主页和具有单独路线的仪表板的应用程序。 If I use ng-route, I will only be able to add stuff onto my homepage. 如果使用ng-route,则只能在首页上添加内容。

Basically, I'm asking how can I have it so when I got to http://example.com/#/features And then go to http://example.com/#/dashboard/control , be able to still use ng-route on my dashboard page, instead of injecting it into my home page. 基本上,我想问的是如何拥有它,所以当我进入http://example.com/#/features然后转到http://example.com/#/dashboard/control时 ,仍然可以使用ng-route在我的仪表板页面上,而不是将其注入到我的主页中。 Is there something I can add to my app.js, or will I have to make an entirely new app.js for my dashboard (which is what I was thinking I have to do) 我可以添加一些东西到我的app.js中,还是必须为我的仪表板制作一个全新的app.js(这是我一直想做的)

I hope this made sense, I've always had trouble explaining things like this :P . 我希望这是有道理的,我一直很难解释这样的事情:P。

Cheers! 干杯!

instead of using ng-route use ui-router , ui-router will provide you better control over navigation 而不是使用ng-route使用ui-routerui-router可以为您提供更好的导航控制

Its can be structured like 它可以像

.state(login)
.state(login.forgotpassword)
.state(dashboard)
.state(dashboard.list)
.state(dashboard.user)

as you see you can have navigation control over two different state. 如您所见,您可以对两个不同的状态进行导航控制。

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

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