2

I am trying to upload-file using angularFileUpload in php,but i will get this error in angular.

[$injector:unpr] Unknown provider: $uploadProvider

I have tried answer from this question but no luck.

Here is my app.js

angular.module('app',[
'ui.router','angularFileUpload'
])
.config(['$urlRouterProvider','$stateProvider',function($urlRouterProvider,$stateProvider){

    $urlRouterProvider.otherwise('/');
    $stateProvider
    .state('home',{
        url:'/',
        templateUrl:'templates/home.html',
        controller:'homeCtrl'
        })
        .state('login',{
        url:'/login',
        templateUrl:'templates/login.html',
        controller:'loginCtrl'
        })
        .state('register',{
        url:'/register',
        templateUrl:'templates/register.html',
        controller:'registerCtrl'
        })
       }]);

Controller.js

angular.module('app')
 .controller('registerCtrl',['$upload',function($scope,$http,$state,$upload){

]});

But still I get this error.

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

Community
  • 1
  • 1
Blessan Kurien
  • 1,645
  • 9
  • 31
  • 63

1 Answers1

0

First why you only have $upload for the dependency injection? you should have all of your parameters.

angular.module('app')
    .controller('registerCtrl' ['$scope', '$http', '$state', '$upload', function($scope, $http, $state, $upload) {

}]);

You have an error at the end, first close the function, then the parenthesis and the the controller function call.

Leandro Zubrezki
  • 1,150
  • 9
  • 12