Getting "Unknown provider: UploadProvider" error using ng file upload

I am trying to use the ng-file-upload directive ( https://github.com/danialfarid/ng-file-upload ) to add file upload functions to my project, but keep getting this error:

Error: [$injector:unpr] http://errors.angularjs.org/1.4.6/$injector/unpr?p0=UploadProvider%20%3C-%20Upload%20%3C-%20ExperimentController
at Error (native)
at http://localhost:8000/static/editor/js/angular.min.js:6:416
at http://localhost:8000/static/editor/js/angular.min.js:40:409
at Object.d [as get] (http://localhost:8000/static/editor/js/angular.min.js:38:394)
at http://localhost:8000/static/editor/js/angular.min.js:40:483
at d (http://localhost:8000/static/editor/js/angular.min.js:38:394)
at e (http://localhost:8000/static/editor/js/angular.min.js:39:161)
at Object.instantiate (http://localhost:8000/static/editor/js/angular.min.js:39:310)
at http://localhost:8000/static/editor/js/angular.min.js:80:313
at A.link (http://localhost:8000/static/editor/js/angular-route.min.js:7:268) <div ng-view="" ng-show="main.results==null" class="ng-scope">

I include the correct files in my index.html:

<script src="/static/editor/js/angular.min.js"></script>
<script src="/static/editor/js/ng-file-upload-shim.js"></script>
<script src="/static/editor/js/ng-file-upload.js"></script>

I declare this as my module:

(function() {
    angular
        .module('myApp', [
            'ngRoute',
            'ngAnimate',
            'ngCookies',
            'ngFileUpload'
    ]);
})();

But when I try to enter it into my controller, it throws the error above:

(function() {
    angular
        .module('myApp')
        .controller('myController', myController);

    myController.$inject = ['$routeParams',
        '$compile',
        '$scope',
        '$interval',
        'Upload'];


function myController($routeParams,
    $compile,
    $scope,
    $interval,
    Upload) {
....

I am using Angular 1.4.6 and ng-file-upload 9.0.14. I downloaded the files manually and included the specified .js files in the project directory. Could there be any additional dependencies that are included via bower or npm that I am missing?

Any help would be greatly appreciated!

UPDATE: ng-file-upload AngularJS 1.4.6 (https://angular-file-upload.appspot.com/#/1.4.6) , 1.4.6 ng .

+4
1

"", ng-file-upload, "ngFileUpload" "".

  myController.$inject = ['$routeParams',
        '$compile',
        '$scope',
        '$interval',
        'ngFileUpload'];

function myController($routeParams,
    $compile,
    $scope,
    $interval,
    ngFileUpload) {
....
+1

Source: https://habr.com/ru/post/1612300/


All Articles