3

this code is working when i run in the browser. But not works in iPhone simulator.

I checked in the console, there is no error.

My goal is to add a Facebook like button which points to my Facebook Page in the ionic app. I try to implement using the basic code from the Facebook developers site. But this is also not working.

Plunker Demo

<script type="text/ng-template" id="like.html">
  <div ng-if="pluginOn" onrender="rendered()" class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
</script>
lin
  • 17,956
  • 4
  • 59
  • 83
Soundhar Raj
  • 623
  • 3
  • 12
  • 26

1 Answers1

2

It won't work for native apps because:

https://developers.facebook.com/docs/ios/like-button/ is not supported yet. You will need a HOST to make it work. Thats why it will work on WebBrowser (Hosted application).

It can be done with the graph API: Built-in Like Button - Facebook SDK 3.0

In that way you have to create it on your own. There are a lot of approaches to do this. One is to do a POST on:

https://graph.facebook.com/me/og.likes?access_token=FB_ACCESS_TOKEN&object=URL_TO_LIKE.

Hint: You will need FB.init() & FB.getLoginStatus() and a accessToken.

If you are using cordova/phoneGap you can use https://github.com/Wizcorp/phonegap-facebook-plugin.

Community
  • 1
  • 1
lin
  • 17,956
  • 4
  • 59
  • 83
  • Thank you for the reply. I will try to implement like you told and i am not using phoneGap. I am using Ionic and Angularjs. – Soundhar Raj May 13 '15 at 16:03