-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub_vericek.html
57 lines (56 loc) · 1.85 KB
/
github_vericek.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body {
font: 14px Arial;
}
.hata {
color: darkred;
border: 1px solid darkred;
padding: 10px;
margin-top: 10px;
}
</style>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript">
// https://api.github.com/users/yusuf6554/repos
var github = angular.module('github', []);
githubRepos = github.controller('githubRepos', ['$scope', '$http', function($scope, $http){
// $scope.soz = 'Ey yükselen yeni nesil, istikbal sizindir. Cumhuriyet\'i biz kurduk, O\'nu yükseltecek ve sürdürecek sizlersiniz.';
$scope.getGithubRepos = function(){
var fncTamam = function(response){
$scope.repos = response.data;
$scope.hata = null;
}
var fncHata = function(response){
$scope.repos = null;
$scope.hata = 'Kullanıcı yok.';
}
$http.get('https://api.github.com/users/' + $scope.kullaniciadi + '/repos').then(fncTamam, fncHata);
}
}]);
</script>
</head>
<body>
<div ng-app="github">
<div ng-controller="githubRepos">
<form ng-submit="getGithubRepos()">
Kullanıcı Adı: <input type="text" ng-model="kullaniciadi" />
</form>
<div class="hata" ng-show="hata">{{ hata }}</div>
<div ng-show="repos">
<ol>
<li ng-repeat="repo in repos">
<span>{{ repo.name }}</span>
<div ng-show="repo.description" style="padding: 5px; border: 1px solid #ddd; width: 300px; margin: 2px 0">{{ repo.description }}</div>
<div ng-show="!repo.description" style="color: #999; padding: 5px; border: 1px solid #ddd; width: 300px; margin: 2px 0">Açıklama Yok</div>
</li>
</ol>
</div>
</div>
</div>
</body>
</html>