I am currently utilizing the Angular Facebook service found at this link. Within my controller, I am attempting to invoke the method $facebook.login() when a button is clicked using ng-click.
Although the promise is returned and the code inside is executed, no login pop-up appears. I have also attempted disabling the Chrome pop-up blocker without success. There are no errors displayed in the console...
Below are snippets of my code:
facebook.html
<div class="container">
<div class="col-md-4">
<h3>Please log in</h3>
<button type="Log In" class="btn btn-default" ng-click="login()">Log In</button>
</div>
facebook.js
'use strict';
angular.module('ngsocial.facebook', ['ngRoute', 'ngFacebook'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/facebook', {
templateUrl: 'facebook/facebook.html',
controller: 'facebookCtrl'
});
}])
.config(function($facebookProvider) {
$facebookProvider.setAppId('1816664965234931');
$facebookProvider.setPermissions("email", "public_profile", "user_posts", "publish_actions", "user_photos");
})
.run(function($rootScope) {
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
(function() {
console.log("I'm loaded");
}());
})
.controller('facebookCtrl', ["$scope" , "$facebook" , function($scope,$facebook) {
$scope.login = function () {
$facebook.login().then (console.log("Promise has been returned"));
}
}]);