我对使用父状态controller
或resolve
验证(用户身份验证)的天气感到困惑。
这是示例代码。
.state('dashboard.action.seller.manageproduct', {
url: '/manageProduct',
template: '<div ui-view></div>',
abstract : true,
controller : function(userRolesFactory){
/*
Here i can resolve or validate all the user roles and make decision wether to go it's chaild state or not for all it chaild states
*/
},
resolve: {
userRoles: ['userRolesFactory', function(userRolesFactory) {
/*
Here also i can resolve or validate all the user roles and make decision wether to go it's chaild state or not for all it chaild states
*/
}]
}
})
.state('dashboard.action.seller.manageproduct.add', {
url: '/addProduct',
// templateUrl: 'module/dashboard/actiontab/seller/manageproduct/view/addProduct.html',
// controller: 'fos.dashboard.actiontab.seller.manageproduct.addproductController',
requireLogin: true
})
.state('dashboard.action.seller.manageproduct.edit', {
url: '/editProduct',
// templateUrl: 'module/dashboard/actiontab/seller/manageproduct/view/editProduct.html',
// controller: 'fos.dashboard.actiontab.seller.manageproduct.editProductController',
params: {
product: null
},
requireLogin: true
})
我的怀疑是:
哪一个最适合验证(controller
级别或resolve
)。
我不希望在所有验证之前显示我的孩子状态模板。
我知道执行顺序。