【发布时间】:2012-11-04 05:45:12
【问题描述】:
我的这个应用有两个模块:
angular.module('components', []).directive('foo', function () { return {};});
angular.module('gaad', ['components']);
有一堆与这个模块相关的指令,我在这里不包括在内。
该应用程序工作正常。但是,当我尝试检索模块 gaad 的注入器时:
var injector = angular.injector(['gaad', 'components']); //called after 'gaad' module initialization
抛出错误:
Uncaught Error: Unknown provider: $compileProvider from components
应用程序现在相当大,我不知道应该去哪里寻找错误。 所以我的问题是:我的问题可能是什么原因?
编辑: 我能够复制我的问题:http://jsfiddle.net/selbh/ehmnt/11/
【问题讨论】:
-
顺便说一句,如果你使用ng-app,你不需要创建应用程序注入器。
标签: angularjs