{"size": 645, "ext": "js", "max_stars_repo_path": "app/controllers/PlayerController.js", "max_stars_repo_name": "flugaan/angular-seed", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/controllers/PlayerController.js", "max_issues_repo_name": "flugaan/angular-seed", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/controllers/PlayerController.js", "max_forks_repo_name": "flugaan/angular-seed", "max_forks_repo_forks_event_min_datetime": "2020-01-20T10:20:55.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-20T10:20:55.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 22.2413793103, "max_line_length": 109, "alphanum_fraction": 0.6062015504}
(function(){

  angular.module('app')
    .controller('PlayerController', ['$state', 'firebaseService', '$log', '$stateParams', PlayerController]);

  function PlayerController($state, firebaseService, $log, $stateParams){

    var vm = this;

    var onPlayerComplete = function(data){
      vm.player = data;
    }

    var onError = function(reason){
      vm.error = 'Error fetching the data';
    }

    if ($stateParams.id < 10 && $stateParams.id > 0){
      var id = '00' + $stateParams.id;
    }
    else {
      var id = '0' + $stateParams.id;
    }

    firebaseService.getPlayer('men', id).then(onPlayerComplete, onError);
  }

}());
