$cordovaInstagram returns unknown Unknown Provider

I am trying to integrate the $cordovaInstagram plugin of ngCordova in my service:

.factory('ShareInstagramFactory', function($cordovaInstagram, $q) {
    var self = this;
    
    // Options
    var shareMessage = "Message";
    
    
    //
    // Instagram
    self.shareInstagram = function(imageData) {
        
        console.log("shareInstagram")
        
        var qInstagram = $q.defer();
        
        $cordovaInstagram.share(imageData, shareMessage).then(function() {
            // Worked
            qInstagram.resolve(true)
         }, function(err) {
            // Didn't work
            qInstagram.reject(err);
         });
        
        return qInstagram.promise;
    };

    return self;
})

However, I get the following issue

Error: $injector:unpr
Unknown Provider

https://docs.angularjs.org/error/$injector/unpr?p0=$cordovaInstagramProvider%20%3C-%20$cordovaInstagram%20%3C-%20ShareInstagramFactory

All my other ngCordova plugins work as expected.

Help!

Did you managed to get it working?

I have a similar problem

It “works” … that is … there is no error, but nothing happens

Did anyone get it to work?
Im having this problem as well.

What is the error you are seeing?

$cordovaInstagram doesn’t exist

I believe the documentation is wrong.
I got around it…Here’s what I did.

  1. Add the ngCordova.plugins.instagram to angular.module
    angular.module('myapp.directives', ['ngCordova.plugins.instagram'])

  2. Then reference it in the controller
    .controller('SettingsCtrl', function($cordovaInstagram) { ...

  3. To share using $cordovaInstagram
    $cordovaInstagram.share({image: imageInBit64, caption: 'Caption Image'})

1 Like