harbor/static/resources/js/components/top-repository/top-repository.directive.js
2016-06-28 14:17:28 +08:00

42 lines
1.1 KiB
JavaScript

(function() {
'use strict';
angular
.module('harbor.top.repository')
.directive('topRepository', topRepository);
TopRepositoryController.$inject = ['ListTopRepositoryService'];
function TopRepositoryController(ListTopRepositoryService) {
var vm = this;
ListTopRepositoryService(5)
.success(listTopRepositorySuccess)
.error(listTopRepositoryFailed);
function listTopRepositorySuccess(data) {
vm.top10Repositories = data || []
console.log(vm.top10Repositories.length);
}
function listTopRepositoryFailed(data, status) {
console.log('Failed list integrated logs:' + status);
}
}
function topRepository() {
var directive = {
'restrict': 'E',
'templateUrl': '/static/resources/js/components/top-repository/top-repository.directive.html',
'controller': TopRepositoryController,
'scope' : true,
'controllerAs': 'vm',
'bindToController': true
};
return directive;
}
})();