ng-imgur
v0.2.1
Published
Take your favourite cat picture, and upload it to Imgur.com w/ Angular!
Downloads
7
Readme
ngImgur
- Heroku: http://ng-imgur.herokuapp.com/
- Bower:
bower install ng-imgur
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!
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
.