2

我正在尝试在 Angular js 中注入服务,但它给出了以下错误。服务名称是 $upload。我的脚本中的代码位于页面顶部 - `angular.module('myApp', ['angularFileUpload']);

我的控制器中的代码$scope.onFileSelect = function($files) { for (var i = 0; i < $files.length; i++) { var file = $files[i]; $scope.upload = $upload.upload({ url: 'server/upload/url', data: {myObj: $scope.myModelObj}, file: file, // or list of files: $files for html5 only }).progress(function(evt) { console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total)); }).success(function(data, status, headers, config) { console.log(data); }); //.error(...) } };

显示的错误是:错误:[$injector:unpr ] http://errors.angularjs.org/1.2.9/$injector/unpr?p0=%24uploadProvider%20%3C-%20%24upload

4

0 回答 0