I am new to angular js I want progress bar line for file upload.
I am getting below error when I am run my code:
angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.6/$injector/modulerr?p0=app&p1=Error%3A%20%…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.6%2Fangular.min.js%3A21%3A332)
Here is my code:
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>
var app = angular.module('myApp', ['angularFileUpload'])
.controller('MyCtrl', ['$scope','$upload', function MyCtrl($upload) {
// .controller("MyCtrl", function ($scope,$upload){
// var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
$scope.onFileSelect = function(files) {
var file = files[0];
$scope.upload = $upload.upload({
url: 'url',
method: 'POST',
withCredentials: true,
data: {type:'uploadzip'},
file: file, // or list of files ($files) for html5 only
}).progress(function(evt) {
console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
$scope.progressBar = parseInt(100.0 * evt.loaded / evt.total);
}).success(function(data, status, headers, config) {
console.log('upload succesfully...')
}).error(function(err) {
console.log(err.stack);
})
}
}]);
</script>
</head>
<body >
<div ng-controller="MyCtrl">
<input type="file" ng-file-select="onFileSelect($files)" multiple>
<div ng-scope='progressBar'>
</div>
</div>
</body>
</html>
Can someone modify my code with correction needed.
scripttag forangularFileUpload: raw.githubusercontent.com/nervgh/angular-file-upload/master/…