Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){ 'use strict';
- function link(scope, el, attr){
- var latest_tweets = el.find('#latest-tweets');
- if(latest_tweets.length) {
- twitterFetcher.fetch(scope.twitterId, '', scope.tweetCount, true, false, true, '', false, handleTweets);
- }
- function handleTweets(tweets){
- var x = tweets.length;
- var n = 0;
- var html = '<ul>';
- while(n < x) {
- html += '<li>' + tweets[n] + '</li>';
- n++;
- }
- html += '</ul>';
- latest_tweets.html(html);
- }
- }
- var ramAngularTweet = function(){
- return {
- restrict: 'EA',
- transclude: true,
- templateUrl: 'template/components/angular-tweet.html',
- link: link,
- scope: {
- twitterId: '@',
- tweetCount: '@',
- cssClass: '@'
- }
- };
- };
- angular.module('ds.components.angular-tweet', []).directive('ramAngularTweet', [ramAngularTweet]);
- angular.module('template/components/angular-tweet.html', []).run(['$templateCache', function($templateCache){
- $templateCache.put('template/components/angular-tweet.html',
- '<div id="latest-tweets"></div>'
- );
- }]);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement