Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.38 KB

README.md

File metadata and controls

65 lines (45 loc) · 1.38 KB

ng-transloadit

A service for uploading to transloadit.com

Purpose & Rationale

  • Upload files with progress indicator

Caveats

Installation

  • require angular (tested on 1.1.2)

Usage

angular.module('myApp', ['ngTransloadit']).controller('MyCtrl', ['$scope', 'Transloadit', (function($scope, Transloadit) {
  $scope.upload = function(file) {
    Transloadit.upload(file, {
      params: {
        auth: {
          key: 'my-auth-key'
        },

        template_id: 'my-template-id'
      },

      signature: function(callback) {
        // ideally you would be generating this on the fly somewhere
        callback('here-is-my-signature');
      },

      progress: function(loaded, total) {
        console.log(loaded + 'bytes loaded');
        console.log(total + ' bytes total');
      },

      processing: function() {
        console.log('done uploading, started processing');
      },

      uploaded: function(assemblyJson) {
        console.log(assemblyJson);
      },

      error: function(error) {
        console.log(error);
      }
    });
  }
}]);

Copyright

Copyright (c) 2012 Cameron Westland. See LICENSE.txt for further details.