Ng-twitter

Angular directive twitter tweets display

Welcome

- input will search for specific twitter hashtag.

- refresh is made every 60 second but you can stop it, enjoy.

Demo real time

HERE IT IS !!!

Demo mock service : no refresh button

Code

<!DOCTYPE html>
<html>
<head>
  ...
  <link href="css/ng-twitter.min.css" rel="stylesheet" />
  <script type="javascripts/javascript" src="angular.min.js" />
  <script type="javascripts/javascript" src="angular-mocks.js" />  
  <script type="javascripts/javascript" src="angular-sanitize.min.js" />  
  <script type="javascripts/javascript" src="ng-twitter.min.js" />
</head>
<body>
  ...
  
  <div ng-app="myApp" ng-controller="ctrl">
    <div tweets hashtag="hashtag" button="true" hash='true' count="3" refresh="15"/>   
  </div>
  
  
  <script type="text/javascript"> 

    var app = angular.module('myApp', ['ngTwitter', 'ngMockE2E']);
    app.run(function($httpBackend) {

      var tweet = {
          "text": "Aggressive Ponytail #hash",
          "retweet_count": 22,
          "entities": {      
              "hashtags": [
                {
                  "text": "hash",
                  "indices": [
                    15,
                    25
                  ]
                }
              ],
              "user_mentions": [            
              ]
           },
        "user": {            
              "screen_name": "toto"                       
          }       
      };  

    var tweets = [];
    for (var i=0;i<15;i++) {
      var t = {};
      angular.copy(tweet, t);     
      t["retweet_count"] = i;
      t["text"] = 'this is a demo #hashtag'+i;
      tweets.push(t);
    }

      var mockTweets = { "statuses": tweets,        
      "search_metadata": {
          "max_id": 250126199840518145,
          "since_id": 24012619984051000         
      }
    };
     
      // returns the current list of phones
      $httpBackend.whenGET('/search?hashtag=football').respond(mockTweets);
          
    });

    function ctrl($scope, $filter) {            
      $scope.hashtag = 'football';
    }

  </script>
      
</body>
</html>

Demo mock service : no hashtag input

Donate