我有一个单页网络应用程序,其模板/网页如下所示:
[模板左 |模板右]
我想设置路由,当某些用户未登录时,他们会转到不同的页面(登录页面),而当他们登录时,路由只会影响 templateRight(这样 templateLeft 就不会重新加载) .
似乎最好的方法是使用路由和 ng-view,但是由于一条路由影响整个页面而一条路由只影响模板对,我不确定如何正确创建 Controller /路由因为看起来您不能嵌套 ng-view。
我错了吗?实现这一目标的好方法是什么?
最佳答案
实际上,这里正在进行 Alpha 开发:https://github.com/angular-ui/ui-router
Main Goal To evolve the concept of an Angular "Route" into a more general concept of a "State" for managing coarse application UI states.
Main Features: A state manager $stateProvider and $state, keeps state logic separate from routing logic. Nested states (parent/child relationships). Can set multiple views via named views. ui-view directive. URL Routing Backwards compatible with Angular v1 router Various other nuggets of goodness
关于angularjs - 你可以在 angularjs 中嵌套 ngView 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13628178/