JSFiddle - React, Tailwind, and code Playground
by dylanfm
HTML
<html ng-app>
<head>
<title>Search</title>
</head>
<body>
<div ng-controller="SearchCtrl">
<input type="search" ng-model="query" placeholder="Search…">
<button ng-click="performSearch()">Get repos</button>
<hr>
<table>
<thead>
<tr>
<th>Name</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="repo in results">
<td>{{repo.name}}</td>
<td>{{repo.url}}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
JavaScript
function SearchCtrl($scope, $http) {
$scope.performSearch = function() {
if ($scope.query) {
// https://api.github.com/users/$scope.query/repos
$http.get('https://api.github.com/users/' + $scope.query + '/repos').success(function(data) {
$scope.results = data;
})
}
}
}