Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs angular-file-upload Unknown provider: $uploadProvider error

This is not a duplicate of This Question

I have included all the required files in view:

<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>

My module and controller:

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.

Error: [$injector:unpr] Unknown provider: $uploadProvider

Please help me out.

like image 398
RandomUser Avatar asked Feb 13 '23 01:02

RandomUser


1 Answers

Hit the same issue, turned out that the documentation to inject $upload is out of date, it should be FileUploader:

controllers.controller('CustomProductsCtrl',
  [..., '$upload', function (..., 'FileUploader') {

Spent more time than I'd like to admit figuring that out. FYI, I determined that by looking at angular-file-upload.js:

.factory('FileUploader', ['fileUploaderOptions', '$rootScope', '$http', '$window', '$compile',
like image 86
UnionP Avatar answered Feb 14 '23 16:02

UnionP