angularjs – 为什么我不能在我的config()中注入$location?
为什么这给我一个错误:
angular.module('app').config(function($routeProvider,$locationProvider,$httpProvider,$location) {
但这行不行? angular.module("app").factory("SomeResource",function($q,$resource,$http,$location,AuthenticationService,Base64) { 这是同一个应用程序可以配置只能获得提供者,工厂只能获得非提供者?
只有提供者和常量可能被注入到配置块中。
配置块基本上是在将提供者注入控制器,服务,工厂等之前配置的地方。 angular.module('myModule',[]). config(function(injectables) { // provider-injector // This is an example of config block. // You can have as many of these as you want. // You can only inject Providers (not instances) // into the config blocks. }). run(function(injectables) { // instance-injector // This is an example of a run block. // You can have as many of these as you want. // You can only inject instances (not Providers) // into the run blocks }); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |