当相同的路径单击时,angular重新加载解析

时间:2016-02-24 14:54:55

标签: javascript angularjs

我使用贝娄代码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]
                  };
    })
  }
 }
})

0 个答案:

没有答案