当前位置: 动力学知识库 > 问答 > 编程问答 >

AngularJS inject issue

问题描述:

recently I'm learning AngularJS and for below snippet code, i have no idea why doing that. Could you help me to understand it, thanks.

 // ----------------- this part --------------

// mainModule.controller = $controllerProvider.register;

// mainModule.directive = $compileProvider.directive;

// mainModule.filter = $filterProvider.register;

// mainModule.factory = provide.factory;

// mainModule.service = provide.service;

And the following is the whole code for your reference.

var mainModule = angular.module('app.test', [])

.run(['$log', function ($log) {

$log.debug('app.test.run()...');

}])

.config(function ($controllerProvider, $compileProvider, $filterProvider, $provide, scriptDependencyProvider, $stateProvider) {

'use strict';

mainModule.controller = $controllerProvider.register;

mainModule.directive = $compileProvider.directive;

mainModule.filter = $filterProvider.register;

mainModule.factory = provide.factory;

mainModule.service = provide.service;

$stateProvider.state({

name: 'main',

url: '/main',

views: {

'@': {

controller: ['$scope', '$stateParams', 'appTranslation',

function ($scope, $stateParams, appTranslation) {

appTranslation.load([appTranslation.main]);

}],

template: '<main-view></main-view>',

}

},

resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.main),

deepStateRedirect: true,

sticky: true

});

});

分享给朋友:
您可能感兴趣的文章:
随机阅读: