Facebook integration


#1

Facebook integration- I have developed an application to find trails near to me, but the problem that i am facing is that when we click on the facebook icon it will lead me to a blank page. but it should redirect to the fb page. it is working on browser. but not on the application.


#2

You need to whitelist external resources, in order to use them.

Take a look at Nic’s guide


#3

I read it and add this code in my index.html, but it still not work.

I did more test on my application. I found it works not only on browser, but also on simulator of ios on my mac. It seems it only not work on ionicView.

Codes I am using are below

.directive(‘fbPost’, function($document) {
return {
restrict: ‘EA’,
replace: false,
link: function($scope, element, attr) {
(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 = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=1643180689265172 ";
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));
}
}

div fb-post class=“fb-page” data-href=“https://www.facebook.com/trailsVictoria” data-small-header=“false” data-adapt-container-width=“true” data-hide-cover=“false” data-show-facepile=“false” data-show-posts=“true”>
/div>