Angular module config not called

后端 未结 3 917
失恋的感觉
失恋的感觉 2020-12-29 04:48

I\'m trying to get my head around AngularJS and ran into a problem.

var myApp = angular.module(\'myApp\', [\'myApp.services\']);

myApp.config([\'$routeP         


        
3条回答
  •  攒了一身酷
    2020-12-29 05:28

    It seems that the method I used for defining the service was overriding my myApp module.

    This is the overriding line

    angular.module('myApp', function ($provide) ...
    

    This code simply redefines the myApp module and adds a function to configure that one.


    I refactored service.js to this simplified version and it started to work.

    var myApp = angular.module('myApp');
    
    myApp.factory('securityService', function () {
        return SomeFancyServiceObject();
    });
    

提交回复
热议问题