ANgular - 在ocLazyLoad加载后,在路由解析中使用服务

时间:2016-08-08 09:12:35

标签: angularjs angular-ui-router angular-services

我想在120 =>abcdefg NULL 中使用state resolve加载的服务ocLazyLoadstate resolve。如下所示:

.state('meniu', {
            url: '/meniu',
            params: { lang: 'ro'},
            templateUrl: 'views/meniu/meniu.html',
            controller: 'meniuController',
            resolve:{
                      loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
                                 return $ocLazyLoad.load(['pageNavPropsService', 'meniuCtrl', 'customHeader', 'customFooter']);

                       }],
                       ,
                       loadMyData: ['$http','$stateParams', 'GetDataService', function($http, $stateParams, GetDataService){
                           var path = '_global/views/services/json/' + $stateParams.lang + '_data.json';
                           return  GetDataService.getData(path);
                       }]

            }
        })

我尝试过这样但没有成功:

loadResources: ['$ocLazyLoad', function($ocLazyLoad) {
                                 return $ocLazyLoad.load(['getDataService','pageNavPropsService', 'bauturiCtrl','customHeader', 'customFooter'])
                                                    .then( function(GetDataService){
                                                        GetDataService.getData("path");
                                                    });
                       }]/*,

如何做到这一点?

0 个答案:

没有答案