-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserController.js
50 lines (38 loc) · 1.39 KB
/
UserController.js
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
(function() {
var mainApp = angular.module("mainApp");
// Initialize the controller
mainApp.controller("UserController",
function($scope, github, $routeParams, $location) {
var onError = function(error)
{
$scope.user = null
$scope.repos = null
$scope.error = "There was something error: " + error.statusText
}
var onGetRepo = function(data)
{
$scope.repos = data
}
var onGetUser = function(data)
{
$scope.user = data
$scope.error = null
github.getRepo(data).then(onGetRepo, onError)
}
$scope.username = $routeParams.username
$scope.repoOrderBy = "-stargazers_count"
github.getUser($scope.username).then(onGetUser, onError)
var onGetCollaborator = function(data)
{
console.log(data)
}
$scope.repoName = function(reposName, openIssue)
{
$scope.openIssues = openIssue
console.log(openIssue)
$scope.reposName = reposName
$location.path("/repo/" + $scope.reposName)
console.log("/repo/"+reposName)
}
})
}())