Injecting Dependencies in config() modules - AngularJS

前端 未结 4 2027
面向向阳花
面向向阳花 2020-11-29 18:45

Currently in app.js i have the following routes:

var gm = angular.module(\'gm\', [\'gm.services\',\'gm.directives\',\'gm.filters\',\'gm.controllers\',\'ngSan         


        
4条回答
  •  情深已故
    2020-11-29 19:18

    In .config you can only use providers (e.g. $routeProvider). in .run you can only use instances of services (e.g. $route). You have a factory, not a provider. See this snippet with the three ways of creating this: Service, Factory and Provider They also mention this in the angular docs https://docs.angularjs.org/guide/services

提交回复
热议问题