-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepoController.js
More file actions
33 lines (24 loc) · 983 Bytes
/
RepoController.js
File metadata and controls
33 lines (24 loc) · 983 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
(function () {
var app = angular.module("githubViewer");
var RepoController = function ($scope, github, $routeParams, $location) {
var onRepoComplete = function (data) {
$scope.repo = data;
github.getRepoContributors($scope.repo.contributors_url)
.then(onRepoContributorsComplete, onError);
};
var onRepoContributorsComplete = function (data) {
$scope.contributors = data;
};
var onError = function (reason) {
$scope.error = "Encountered an error fetching the data";
};
var onUserClicked = function () {
$location.path("/main")
}
$scope.username = $routeParams.username;
$scope.reponame = $routeParams.reponame;
$scope.contibSortOrder = "login";
github.getRepo($scope.username, $scope.reponame).then(onRepoComplete, onError);
};
app.controller("RepoController", RepoController);
}());