我需要将后端分段到仪表板布局和登录布局 . 它必须是两种不同的布局 .
我如何使用angular-ui-router实现这一点?
index.html
<body ng-controller="MainCtrl">
...
<div id="page-wrapper" ui-view>
...
JS
app.config(['$stateProvider', function($stateProvider){
$stateProvider.
state('login', {
url: '/login',
templateUrl: 'assets/templates/login.html',
controller: 'AuthCtrl'
}).
state('/products', {
url: '/products',
templateUrl: 'assets/templates/product-list.html',
controller: 'ProductListCtrl'
}).
state('/categories', {
url: '/categories',
templateUrl: 'assets/templates/category-list.html',
controller: 'CategoryListCtrl'
}).
state('/product/add', {
url: '/product/add',
templateUrl: 'assets/templates/add-product.html',
controller: 'AddProductCtrl'
}).
...
}]);
1 回答
我已经为Angular here中的多个layots路由找到了非常好的解决方案 .
它基于内置的Angular的$ route引擎,该引擎将其扩展为Angularjs中的高级路由 .
还想补充一点,使用和阅读非常简单,非常直观 .
为了更好地理解下面是解决我的特定问题的例子 . 一切都很好 .