0
//這是我的固定模塊文件 constant.js未知提供商:ROUTESTATE_CONSTANTProvider < - ROUTESTATE_CONSTANT < - myCtrl
angular.module('constantModule')
.constant('ROUTESTATE_CONSTANT', {
LOGIN: 'page.login',
AGENCY_EDIT: 'app.editAgency',
AGENCY: 'app.agency',
USER_ADD: 'app.addUser',
USER: 'app.user',
BRAND_EDIT: 'app.editBrand',
BRAND: 'app.brand',
INTERNATIONAL_COMPANY_EDIT: 'app.editInternationalCompany',
INTERNATIONAL_COMPANY: 'app.international_company',
LOCATION_EDIT: 'app.editLocation',
LOCATION: 'app.location',
PROJECT: 'app.project',
PROJECT_EDIT: 'app.editProject',
PROJECT_ADD: 'app.addProject',
PRODUCT: 'app.product',
PRODUCT_EDIT: 'app.editProduct',
VENDOR: 'app.vendor',
VENDOR_EDIT: 'app.editVendor',
PO_EDIT: 'app.editPurchaseOrder',
PURCHASE_ORDER: 'app.purchase_order',
CONTRACT : 'app.contract',
CONTRACT_EDIT: 'app.editContract'
});
這我app.js文件
angular.module('app.lazyload',['oc.lazyLoad'])
.config(function($ocLazyLoadProvider) {
$ocLazyLoad.load('constantModule');
return $ocLazyLoadProvider.config({
//debug: true,
events: true,
serie:true,
modules: [{
name: 'constantModule',
files: [
'App/Constants/constant.js'
]
}]
});
});
angular.module('myconstant.constant', ['constantModule']);
angular.module('MyApp',['ui.router','myconstant.constant'])
.controller('myCtrl',['ROUTESTATE_CONSTANT',function(ROUTESTATE_CONSTANT,{
console.log(ROUTESTATE_CONSTANT);
}]);
angular.element(function(){
angular.bootstrap(document,['MyApp']);});
我想使用oclazyload按需加載常量模塊,並將其注入anularjs應用程序以供進一步使用。但它給了我一個錯誤'ROUTESTATE_CONSTANTProvider < - ROUTESTATE_CONSTANT < - myCtrl'。
不,它不工作! –