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.
<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>
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.