A wrapper around the ng-file-upload directive which interacts wiith the upload service
in order to have the uploaded files shown in a layer window like google drive uploads. The then
function of the returned object is
decorated in order to manage different information and wrap the callbacks success
, error
and progress
- uploads shown in a position fixed window placed in the bottom right of the viewport
- upload window can be iconized
- upload window can be closed there isn't any running upload
- progress bar and remaining time
- current running uploads
-
install the package and its requirements
bower install ng-upload-window --save
-
include the ng-upload-window js and css in your document
<script src="dist/ng-upload-window.js"></script> <link type="text/css" rel="stylesheet" href="dist/ng-upload-window.css" />
-
include ngUploadWindow as a dependency in your application module:
var app = angular.module('myApp', ['ngUploadWindow']);
-
include the directive in your base template
<upload-window></upload-window>
-
inject UploadWindow provider in your service
angular .module('myApp.services', []) .factory('myService', myService); myService.$inject = ['UploadWindow']; function myService(UploadWindow) { var service = { uploadAttachment: uploadAttachment }; return service; ///////////////////// function uploadAttachment(file) { return UploadWindow.upload({ url: '/my-add-attachment-api-url/', method: 'POST', file: file, fileFormDataName: 'file' }); } }
- abidibo (abidibo@gmail.com)