我们可以在 angularJS app.js 中一起使用 ngRoute 和 ui.router 吗? [英] Can we use ngRoute and ui.router together in angularJS app.js?
问题描述
以前,我在主控制器中使用 ngRoute
.我必须创建子视图功能,它只能通过 UI-Router
实现.请建议?
Previously, I was using ngRoute
in my main controller. I have to create child view functionality and it is only achieved by UI-Router
. please suggest?
推荐答案
是的,你可以使用 ngRoute
/angular-route
($routeProvider
>) 和 ui-router
($stateProvider
) 在一起(特别是第一个里面的第二个).检查 这个 repo 的主人 以找到示例.简而言之,在这种情况下,ui-router
将有可能在ng-view
-provided space"内提供导航和嵌套状态/视图.我已经用更多细节和优点/缺点回答了几乎相同的问题 在 Quora
Yes, you can use ngRoute
/angular-route
($routeProvider
) and ui-router
($stateProvider
) together (in particular, the second inside of the first). Check this repo's master to find the example.
In a couple of words, the ui-router
in this case will have the possibility to provide navigation and nested states/views inside of "ng-view
-provided space".
I have answered almost the same question with more details and pros/cons at Quora
这篇关于我们可以在 angularJS app.js 中一起使用 ngRoute 和 ui.router 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!