0

modules在创建服务之后,我为我的factory. 后来我试图在我的控制器中使用,但我收到一个错误:

Unknown provider: authFactoryProvider <- authFactory <- mainController

这里有什么问题?

我的模块文件:

(function(){

    "use strict";

    var ngModules =  ['ui.router'];

    var appModules = ['meanOffice.factories','meanOffice.controllers', 'meanOffice.directives'];

    var modules = [];

    modules = modules.concat( ngModules );
    modules = modules.concat( appModules );

    angular.module('meanOffice.factories',[]);
    angular.module('meanOffice.controllers', []);
    angular.module('meanOffice.directives', []);

    angular.module( 'meanOffice', modules );

})();

我的工厂:

(function(){

    "use strict";
     // alert('hi'); -works 

    angular.module('meanOffice.factories')
        .factory('authFactory', function($scope){

            var authFactory = {};


            authFactory.init = function(){

                console.log(' init called ');

            }

            return authFactory;

        })

})();
4

0 回答 0