Angular.js:值()的配置不注射() [英] Angular.js: value() not injected in config()

查看:96
本文介绍了Angular.js:值()的配置不注射()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/12903338/angularjs-dependency-injection-of-value-inside-of-module-config\">AngularJS里面的值依赖注入module.config

我有麻烦()的值注入的app.config()。这里的code(CoffeeScript的)

I am having trouble getting the value() injected into the app.config(). Here's the code (coffeescript)

window.app = angular.module("app", [])

app.value("template_path", "assets/angular/templates/users")

app.config(["$routeProvider","template_path" ($routeProvider, template_path) ->
  console.log template_path

它抛出一个未知供应商:从应用template_path错误

it is throwing an "Unknown provider: template_path from app" error

难道说的配置()方法不能与值()设定值注入?
我使用1.0.2

Could it be that the config() method cannot be injected with value() set values? I am using 1.0.2

推荐答案

是的,你是正确的怀疑:价值不能被注入到配置块。 配置块只能有常量和供应商注入

Yes, you were suspecting correctly: values can't be injected into the config block. The config block can only have constants and providers injected.

这篇关于Angular.js:值()的配置不注射()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆