phonegap plugin in Angularjs ngCordova

Asked

Viewed 71 times

1

I have a slight difficulty in understanding how to install these plugins, in general they never work for lack of some file I haven’t called or anything like that.

For example, this facebook plugin that phonegap forces you to use for better performance results, https://github.com/Wizcorp/phonegap-facebook-plugin. Browser method via ngCordova: http://ngcordova.com/docs/plugins/facebook/

I install it via git-shell, all right. I move the js file to the js folder of my root, I call this js on index, but even so, when I call the function, it tells me it is undefined.

There is something else I need to know when installing these plugins?

Grateful From Now!

Edit:

I’m trying to insert the method this way:

myApp.config(function($cordovaFacebookProvider) {
var appID = 123456789;
var version = "v2.0"; // or leave blank and default is v2.0
$cordovaFacebookProvider.browserInit(appID, version);
});

But the following error appears: Uncaught Error: [$injector:modulerr]

I tried this way, but it didn’t work either:

$scope.testeButton = function(name,description,image){
        myApp.config(["$cordovaFacebookProvider",function($cordovaFacebookProvider) {
              var appID = xxxxxxxxxx;
              var version = "v2.5"; // or leave blank and default is v2.0
              $cordovaFacebookProvider.browserInit(appID, version);
              console.log('aqui');
            }]);

        var options = {
            method: "feed",
            link: "http://example.com",
            caption: "Such caption, very feed."
      };
        $cordovaFacebook.showDialog(options)
            .then(function(success) {
              // success
            }, function (error) {
              // error
            });
    }

Appeared cordovaFacebook is not defined

  • I think we need to inject angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ngCordova', 'ui.utils.masks']). So for example.

  • I understood what you meant, but what would inject this plugin?

  • Good question, reading better documentation does not say about injecting :(

  • I get confused in these plugins because the explanation is very succinct.

  • I found out that I have to inject a $cordovaFacebook into my module.config, http://ngcordova.com/docs/plugins/facebook/.<br /> The problem now is that I add this under my myapp, but there is an error in the app.

  • Try to edit the question and show the error that is giving, will be better to understand.

  • it seems that the way I’m trying to install, does not accept. <br /> Uncaught Error: [$injector:modulerr]

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.