1

I'm working on ionic project and i have installed this plugin cordova-plugin-facebook4 but when i'm trying to use it in controller

    .controller('LoginCtrl', function($scope) {
        console.log ("dzdqsdqs");

    $scope.login=function() {
      console.log ("dzdqsdqs");
            facebookConnectPlugin.login(['email'], function(response) {
                alert('Logged in');
                alert(JSON.stringify(response.authResponse));
            }, function(error){
                alert(error);
            })
        }
})

I got this error : ReferenceError: facebookConnectPlugin is not defined

bakrim
  • 145
  • 1
  • 2
  • 11

1 Answers1

0

As mentioned by @bakrim in the comments, you need to run this code on a device or emulator.

To run on an iOS emulator:

ionic platform add ios
ionic build ios
ionic emulate ios

To run on an Android simulator:

ionic platform add android
ionic build android
ionic emulate android

For more information on running on real devices: http://junerockwell.com/how-to-run-ionic-on-real-devices/

Joel Brewer
  • 1,622
  • 19
  • 30