Add on my ionic2 app Facebook like button


#1

Hi All,
I would put in my ionic 2 app a facebook like button, it’s possible?

I try:

<div id="fb-root"></div>
<script>(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#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<!-- Your like button code -->
<div class="fb-like" 
	data-href="http://www.your-domain.com/your-page.html" 
	data-layout="standard" 
	data-action="like" 
	data-show-faces="true">
</div>

But don’t works. Any ideas?
Thank’s in advanced.
Link77


#2

You could do, but it wouldn’t work the way you are attempting.

You’d probably want to make an angular 2 component for this and use the raw javascript api


#3

Thank’s a lot; do you have an example?
Thank’s.
Link77


#4

You’d probably want to look for a facebook js-client on npm then install the extra type needed for it

https://www.npmjs.com/package/@types/facebook-js-sdk


#5

did you find a way to do it ? Could you share it ?