Skip to main content

How to get facebook user details using AngularJS



In this tutorial I have explain about the fetch Facebook user details using AngularJS
<html ng-app id="customersApp">
  <head>
    <title>How to get facebook user details using AngularJS Tutorials</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
    <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script>
      var app = angular.module('customersApp',[]);
      function facebookController($scope, $http) {
          //DwayneJohnson - facebook UserId
          $http.get('https://graph.facebook.com/?id=DwayneJohnson')             .success(function (data) {               $scope.customers = data;           });
      }
    </script>
    <style>
      table {
        margin-left: 300px;
        color: #333;
        font-family: Helvetica, Arial, sans-serif;
        width: 640px;
        border-collapse:
        collapse; border-spacing: 0;
      }
      td{ border: 1px solid #CCC; height: 30px; }
      td {
        background: #FAFAFA;
        text-align: left; 
        padding-left: 3px;
      }
      .user-image {
        width: 350px;
        height: 150px;
      }
    </style>
  </head>
  <body>
    <h1>How to get facebook user details using AngularJS Tutorials</h1>
    <div ng-controller="facebookController">
      <br/>
      <table>
          <tr>
              <td>ID</td>
              <td> {{ customers.id }} </td>
          </tr>
          <tr>
              <td>About</td>
              <td> {{ customers.about }} </td>
          </tr>
          <tr>
              <td>Category</td>
              <td> {{ customers.category }} </td>
          </tr>
          <tr>
              <td>Link</td>
              <td> {{ customers.link }} </td>
          </tr>
          <tr>
              <td>Likes</td>
              <td> {{ customers.likes }} </td>
          </tr>
          <tr>
              <td>Name</td>
              <td> {{ customers.name }} </td>
          </tr>
          <tr>
              <td>Username</td>
              <td> {{ customers.username }} </td>
          </tr>
          <tr>
              <td>Image</td>
              <td>
                <img src= "{{ customers.cover.source }}" class="user-image"/>
              </td>
          </tr>
      </table>
    </div>
 </body>
</html>


Output :


Comments

Popular posts from this blog

PG::DuplicateTable: ERROR: relation "taggings" already exists in Ruby on Rails

Error: PG::DuplicateTable: ERROR:  relation "taggings" already exists Solution : Already the table present in your database.But migration also trying to create a table in database.For this reason error occurred. So try to remove the table (taggings) from your database.   postgresql :     > DROP TABLE IF EXISTS taggings;   Rails console :     > ActiveRecord::Migration.drop_table(:taggings)

How to get a YouTube video thumbnail dynamically from the YouTube API using AngularJS

In this tutorial I have explain about the get YouTube thumbnail using AngularJS <html ng-app id="YoutubeApp">   <head>     <title>       How to get a YouTube video thumbnail dynamically from the YouTube API using  AngularJS Tutorials</title>     <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>     <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>     <script>       function YoutubeController ($scope) {         $scope.todos = [];         $scope. addVideo = function() {           $scope.todos.push({text:$scope.todoText, done:false});           $scope.todoText = '';  ...

Ruby on Rails pagination using Kaminari Gem

Kaminari gem is used to create pagination in Ruby on Rails application.           Step 1: Open the terminal and Create the new application       >  rails new simplepage       Step 2: After you create the blog application, switch to its folder:             > cd simplepage             Step 3: Open and Add it to your Gemfile to following line           gem 'kaminari'           Step 4: Run the bundle install.It's used to install the gem dependencies that are  already mentioned in Gemfile               > bundle install             Step 5: create the form using scaffolding. Rails scaffolding is a quick way to generate some of the major pieces of an application.(Create, Edit, Delete, Update, Show) ...