Skip to content
Snippets Groups Projects
Select Git revision
  • 43e7e727b08a6b050640d7f2cfc6a9da0a20482a
  • master default
2 results

controller.js

Blame
  • controller.js 3.94 KiB
    /**
     * Created by jeremyguiselin on 01/12/2017.
     */
    
     (function (angular) {
       "use strict";
    
       /**
        * @ngdoc controller
        * @name FootballDetailsController
        *
        * @description
        * Controller for all the predictions of a football league.
        *
        * @ngInject
        */
       function FootballDetailsController(
         $ionicHistory,
         $scope,
         $http,
         $ionicLoading,
         constantConfig
       ) {
         /**
         Scope variables
         **/
    
         $scope.locale = window.navigator.language.split('-')[0];
         $scope.pictureUrl = constantConfig.imgUrl;
    
         /**
         End Scope variables
         **/
    
         /**
         Static variables
         **/
    
         var self = this;
         var deregistrationCallbackList = [];
    
         /**
         End Static variables
         **/
    
         /**
         Scope functions
         **/
    
         $scope.myGoBack = function() {
           $ionicHistory.goBack();
         };
    
    
         $scope.getPredictionClass = function (prediction, value) {
           var percentages = [
             prediction.prediction_win_first,
             prediction.prediction_win_second,
             prediction.prediction_draw
           ];
           percentages.sort();
           if (percentages.indexOf(value) === 2) {
             return "main-prediction";
           } else if (percentages.indexOf(value) === 1) {
             return "second-prediction";
           }
    
           return '';
         }