Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
feat(plugin): Add Instagram support
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Mar 23, 2015
1 parent b5e612d commit b9ec3fa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/plugins/instagram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// install : cordova plugins add https://github.com/vstirbu/InstagramPlugin
// link : https://github.com/vstirbu/InstagramPlugin

angular.module('ngCordova.plugins.instagram', [])

.factory('$cordovaInstagram', ['$q', function ($q) {

return {
share: function (options) {
var q = $q.defer();

if (!window.Instagram) {
console.error('Tried to call Instagram.share but the Instagram plugin isn\'t installed!');
q.resolve(null);
return q.promise;
}

Instagram.share(options.image, options.caption, function(err) {
if(err) {
q.reject(err);
} else {
q.resolve(true);
}
});
return q.promise;
}
};
}]);

0 comments on commit b9ec3fa

Please sign in to comment.