angular-plupload

WebJar for angular-plupload

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-plupload
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

angular-plupload
WebJar for angular-plupload
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/remotty/angular-plupload

Download angular-plupload

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-plupload/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-plupload</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-plupload/
implementation 'org.webjars.bower:angular-plupload:0.1.6'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-plupload/
implementation ("org.webjars.bower:angular-plupload:0.1.6")
'org.webjars.bower:angular-plupload:jar:0.1.6'
<dependency org="org.webjars.bower" name="angular-plupload" rev="0.1.6">
  <artifact name="angular-plupload" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-plupload', version='0.1.6')
)
libraryDependencies += "org.webjars.bower" % "angular-plupload" % "0.1.6"
[org.webjars.bower/angular-plupload "0.1.6"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.2.0,1.6)
org.webjars.bower : plupload jar [2.1.2,2.2)

Project Modules

There are no modules declared in this project.

angular-plupload

AngularJS directive for Plupload

Getting started

(1) Get angular-plupload via Bower

$ bower install angular-plupload

or add bower.json

$ bower install angular-plupload --save

(2) add javascript link to html

...
<script src="bower_components/plupload/js/plupload.full.min.js"></script>
<script src="bower_components/angular-plupload/dist/angular-plupload.min.js"></script>
...

(3) add 'angular-plupload' to your main module's list of dependencies

var myApp = angular.module('myApp', ['angular-plupload']);

(4) enjoy!

Quick example

app.js (global plupload setting)

Plupload setting

angular.module('myApp', ['angular-plupload'])
.config(function (pluploadOptionProvider) {
  // global setting
  pluploadOptionProvider.setOptions({
    flash_swf_url: '/bower_components/plupload/js/Moxie.swf',
    silverlight_xap_url: '/bower_components/plupload/js/Moxie.xap',
    max_file_size: '10mb',
    ...
  });
});

controller

basic

$scope.fileUpload = {
  url: '/posts/1/attachments'
}

edit setting

$scope.fileUpload = {
  url: '/posts/1/attachments',
  options: {
    multi_selection: false,
    max_file_size: '32mb',
    headers: {
      'token': 'xxx token'
    }
  }
}

use callback

Plupload event

$scope.fileUpload = {
  url: '/posts/1/attachments',
  callbacks: {
    filesAdded: function(uploader, files) {
      $scope.loading = true;
      $timeout(function() { 
        uploader.start(); 
      }, 1);
    },
    uploadProgress: function(uploader, file) {
      $scope.loading = file.percent/100.0;
    },
    fileUploaded: function(uploader, file, response) {
      $scope.loading = false;
      alert('Upload Complete!');
    },
    error: function(uploader, error) {
      $scope.loading = false;
      alert(error.message);
    }
  }
}

view

basic

<a plupload="fileUpload.url">
  Upload Button
</a>

basic (with static value)

<a plupload="'/upload'">
  Upload Button
</a>

edit setting

<a plupload="fileUpload.url"
   plupload-options="fileUpload.options">
  Upload Button
</a>

use callback

<a plupload="fileUpload.url"
   plupload-callbacks="fileUpload.callbacks">
  Upload Button
</a>

edit setting & use callback

<a plupload="fileUpload.url"
   plupload-options="fileUpload.options"
   plupload-callbacks="fileUpload.callbacks">
  Upload Button
</a>

Links

Contributing

  1. Fork it ( https://github.com/remotty/angular-plupload/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
org.webjars.bower

remotty

Versions

Version
0.1.6