I want to use the Cordova facebook plugin for my project. Since the instructions are done for phonegap I get confused when I have to use it only on angular.
So here is what I have so far.
1.I add the CordovaFacebook.js in my scripts and reference it in bundleConfig. 2.I create a new service.js file like this:
'use strict';
var app = angular.module('app.FacebookService', []); // extend the app
var plugin = new CC.CordovaFacebook();
app.factory('FacebookService', [ 'plugin', function(plugin) {
plugin.init('1111111111', 'Cordova',
['public_profile', 'email', 'publish_actions'],
function(response) {
if (response) {
console.log("Access token is: " + response.accessToken);
console.log("Expires: " + response.expirationDate);
console.log("Permissions are: " + response.permissions);
}
}, failureCallback);
plugin.login(function(response) {
console.log("Access token is: " + response.accessToken);
console.log("Expires: " + response.expirationDate);
console.log("Permissions are: " + response.permissions);
}, failureCallback);
}]);
- I add this app.service in the App.js file
- And at this point I am stuck, when I run my application it says
CCfromCC.CordovaFacebook()is not defined.
Can you please let me know how is this done step by step. What am I missing ?
Aucun commentaire:
Enregistrer un commentaire