Ionic AngularJS Facebook like button for Facebook page
this code works when i run in browser. But doesn't work in iPhone simulator.
I checked in the console, there is no error.
My goal is to add a Facebook button that points to my Facebook page in the ionic app. I am trying to implement basic code from Facebook developers site . But that doesn't work either.
<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>
source to share
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 for it to work. That is why it will work for WebBrowser (Hosted application).
This can be done using the graphical API: Built-in Like Button - Facebook SDK 3.0
So you have to create it yourself. There are many approaches for this. One of them is to do a POST:
https://graph.facebook.com/me/og.likes?access_token=FB_ACCESS_TOKEN&object=URL_TO_LIKE .
Hint: you need FB.init()
both FB.getLoginStatus()
and accessToken
.
If you are using cordova / phoneGap you can use https://github.com/Wizcorp/phonegap-facebook-plugin .
source to share