Sunday 24 January 2016

Facebook - share Dialog - FB.Ui

Facebook Share Dialog: JavaScript and Angular JS
================================================

Register with Developer.facebook.com as developer in public profile (FB Id/user account Required)

Step:1
=======
list required are:

Domain Name, App Name(APPID), URL, OAuthRedirect Url, Review and status as public, Select platform as Website/Android/iOS...

Step:2
======
Include FB_SDK in index.html:

<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_GB/sdk.js#xfbml=1&version=v2.5&appId=654932564610265";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>

step:3
======
Add the facebook connect page - onclick open popup dialog - Required page and section

<li>
  <a target="_blank" ng-click="FBConnect()">
  <img class="fa fa-facebook" src="../../fb.png" /></a>
</li>


step:4
=======

Call or Define Controller method for FB- within controller

$scope.FBConnect = function() {

        FB.ui({
          method: 'share',
          href: 'http://trinet.bornbaby.com/',
          title: 'Bahubali',
          picture: 'http://trinet.bornbaby.com/blog/blog-ps-1.jpg/blog-ps-1.jpg',
          caption: 'Domain Internet',
          description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',

        }, function(response) {});

      }

No comments:

Post a Comment