-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserController.js
More file actions
42 lines (23 loc) · 988 Bytes
/
Copy pathUserController.js
File metadata and controls
42 lines (23 loc) · 988 Bytes
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
// Code goes here
(function() {
var app = angular.module("githubViewer");
var UserController = function($scope, github , $http, $routeParams) {
var onUserComplete = function(data) {
//$scope.user = response.data;
// $http.get($scope.user.repos_url).then(onRepos, onError);
$scope.user = data;
github.getRepos($scope.user).then(onRepos);
};
var onRepos = function(data) {
//$scope.repos = response.data;
$scope.repos = data;
};
var onError = function(reason) {
$scope.error = "Can't retrieve data.";
};
$scope.username = $routeParams.username;
$scope.repoSortOrder = "-stargazers_count";
github.getUser($scope.username).then(onUserComplete);
};
app.controller("UserController", UserController);
}());