这不是
This Question的重复
我在视图中包含了所有必需的文件:
<script src="~/Scripts/angular-file-upload-master/examples/console-sham.min.js"></script> <script src="~/Content/js/angular.js"></script> <script src="~/Scripts/angular-file-upload-master/angular-file-upload.js"></script>
我的模块和控制器:
var controllers = angular.module('controllers',['ngGrid','ngDialog','angularFileUpload']); controllers.controller('CustomProductsCtrl',['$scope','$window','CommonService','CustomProductsServices','$upload',function ($scope,$window,ngDialog,CommonService,CustomProductsServices,$upload){ });
但我仍然得到这个错误.
错误:[$injector:unpr]未知提供者:$uploadProvider
请帮帮我.
解决方法
您似乎没有正确关闭控制器声明.
具体来说,你有:});当你应该有}]);代替.注意缺失].
在上下文中,您应该:
var controllers = angular.module('controllers',$upload){ }]); // Note: missing ']' added in here
因为我们需要遵循declaring a controller的形式.controller API很简洁,但非常简洁:
$controller(constructor,locals);
哪个扩展到您的情况:
module_name.controller( 'your_Ctrl',[locals,function(){ } ] );