JSFiddle - React, Tailwind, and code Playground
by vvakame
HTML
<div ng-app="twitter">
<div ng-controller="Controller">
<ul>
<li ng-repeat="tweet in tweets">
<hr>
{{tweet.from_user_name}} 「{{tweet.text}}」
</li>
</ul>
</div>
</div>
JavaScript
angular.module("twitter", [], function () {
})
.factory("twitterService", function ($http) {
return new TwitterService(api);
});
function TwitterService($http) {
this.getList = function () {
return $http({
method: "JSONP",
url: "http://search.twitter.com/search.json?q=vvakame&callback=JSON_CALLBACK"
});
};
}
function Controller($scope, twitterService) {
twitterService.getList().success(function(data) {
$scope.tweets = data.results;
});
};