这是不是这个问题重复
我已经包括针对所有必需的文件:
<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', 'ngDialog', 'CommonService',
'CustomProductsServices', '$upload',
function ($scope, $window, ngDialog, CommonService,
CustomProductsServices, $upload){
});
但我仍收到此错误。
But still I get this error.
错误:[$喷油器:unpr]未知提供商:$ uploadProvider
请帮助我。
看来,你没有正确关闭控制器
声明。
It appears that you didn't close the controller
declaration correctly.
具体而言,您有:});
的时候,你应该有}]);
来代替。注意失踪]
。
Specifically, you have: });
when you should have }]);
instead. Note the missing ]
.
在情况下,你应该有:
var controllers = angular.module('controllers', ['ngGrid', 'ngDialog', 'angularFileUpload']);
controllers.controller('CustomProductsCtrl',
['$scope', '$window', 'ngDialog', 'CommonService',
'CustomProductsServices', '$upload',
function ($scope, $window, ngDialog, CommonService,
CustomProductsServices, $upload){
}]); // Note: missing ']' added in here
因为我们需要遵循声明控制器。该控制器API 是简洁,而且pretty succint:
because we need to follow the form of declaring a controller. The controller API is terse, but pretty succint:
$controller(constructor, locals);
从而扩大您的情况:
Which expanded to your case:
module_name.controller( 'your_Ctrl',
[locals, function(){
}
]
);
我额外的间距增加调出丢失的]
,并展示如何我们在声明中封山育林元素。
I added in extra spacing to call out the missing ]
and to show how we're closing off elements within the declaration.