[英]Unknown provider Error when trying to inject dependency on Angular controller
I'm trying to inject "modal" directive in my userMenuController the following way: 我正在尝试通过以下方式在userMenuController中插入“模态”指令:
angular.module('mgApp.controllers').controller('userMenuController', ['$scope', 'modals', function($scope, modals) { ... }])
Here's modals.js: 这是modals.js:
angular.module('mgApp.directives').directive('modals', function(){ ... })
And on app.js, app is defined like this: 在app.js上,app的定义如下:
var app = angular.module('mgApp',['templates', 'angularUtils.directives.dirPagination', 'mgApp.filters', 'mgApp.directives', 'mgApp.services', 'mgApp.controllers']);
But I keep getting this error: 但我不断收到此错误:
Error: [$injector:unpr] Unknown provider: modalsProvider <- modals <- userMenuController
What am I missing? 我想念什么?
a quick thought: make sure you have included all .js files as 快速思考:确保已将所有.js文件包含为
<script src="*.js"></script>
in index.html file 在index.html文件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.