我使用贝娄代码reload
route
,但它仅reload
视图。我在路由定义文件中定义了resolve
对象。我怎么能用resolve
重新加载路线?
$rootScope.changeRoute = function(){
var currentPageTemplate = $route.current.templateUrl;
$templateCache.remove(currentPageTemplate);
$route.reload();
};
route.js
.when('/invoice/', {
title: 'invoice',
templateUrl: 'views/invoice/index.html',
controller: 'invoiceController',
resolve: {
getInvoices: function (getInvoicesService, getDashbordService, dataService, $q, $rootScope) {
var invoices = getInvoicesService;
var userDefaults = getDashbordService || dataService.get();
return $q.all([invoices, userDefaults]).then(function(results){
userDefaults.then(function(data){
$rootScope.menus = data.user_menu;
});
return {
'data' : results[0],
'defaults' : results[1]
};
})
}
}
})