dsfhe34889 2015-11-01 07:08
浏览 153

Angularjs文件上传:错误:[$ injector:unpr]未知提供者:$ uploadProvider < - $ upload

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

  • 写回答

1条回答 默认 最新

  • donglangtun1850 2015-11-01 08:54
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?