Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. (function(){ 'use strict';
  2.  
  3. function link(scope, el, attr){
  4. var latest_tweets = el.find('#latest-tweets');
  5. if(latest_tweets.length) {
  6. twitterFetcher.fetch(scope.twitterId, '', scope.tweetCount, true, false, true, '', false, handleTweets);
  7. }
  8.  
  9. function handleTweets(tweets){
  10. var x = tweets.length;
  11. var n = 0;
  12. var html = '<ul>';
  13. while(n < x) {
  14. html += '<li>' + tweets[n] + '</li>';
  15. n++;
  16. }
  17. html += '</ul>';
  18. latest_tweets.html(html);
  19. }
  20. }
  21.  
  22. var ramAngularTweet = function(){
  23. return {
  24. restrict: 'EA',
  25. transclude: true,
  26. templateUrl: 'template/components/angular-tweet.html',
  27. link: link,
  28. scope: {
  29. twitterId: '@',
  30. tweetCount: '@',
  31. cssClass: '@'
  32. }
  33. };
  34. };
  35.  
  36. angular.module('ds.components.angular-tweet', []).directive('ramAngularTweet', [ramAngularTweet]);
  37.  
  38. angular.module('template/components/angular-tweet.html', []).run(['$templateCache', function($templateCache){
  39. $templateCache.put('template/components/angular-tweet.html',
  40. '<div id="latest-tweets"></div>'
  41. );
  42. }]);
  43. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement