ng-imgur

0.2.1 • Public • Published

ngImgur

Travis   npm

Getting Started

With ngImgur you can easily add a component on your website to facilitate the uploading of wonderful cat pictures to Imgur.com r/cats. Meow!

Understand Me

Add the ngImgur module as a dependency to your application:

$angular.module('myApp', ['ngImgur']);

And then import the service into any of your controllers, services, or directives:

myApp.controller('CatController', function(imgur) {
    // ...
});

Then with your image (see FileReader) invoke the imgur.upload method:

imgur.upload(file).then(function then(model) {
    console.log('Your adorable cat be here: ' + model.link);
});

Using the upload method you can also upload an array of images – everything remains the same except the argument passed into then which would be a collection of the models.

imgur.upload([firstFile, secondFile, thirdFile]).then(function then(collection) {
    console.log('You uploaded ' + collection.length + ' balls of fur!');
});

Tests

All of the ngImgur tests can be run using Karma with the easiest method being the grunt test command after you've installed all Bower dependencies with bower install.

Dependents (0)

Package Sidebar

Install

npm i ng-imgur

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • wildhoney