Skip to content
Snippets Groups Projects
Select Git revision
  • master default
1 result

controller.js

Blame
  • controller.js 3.84 KiB
    /**
     * Created by jeremyguiselin on 01/12/2017.
     */
    
     (function (angular) {
       "use strict";
    
       /**
        * @ngdoc controller
        * @name TennisDetailsController
        *
        * @description
        * Controller for all the predictions of a tennis league.
        *
        * @ngInject
        */
       function TennisDetailsController(
         $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.isUndefined = function (value) {
           return typeof value === 'undefined' || value === null;
         };
    
         $scope.myGoBack = function() {
           $ionicHistory.goBack();
         };
    
    
         $scope.getPredictionClass = function (prediction, value) {
           var percentages = [
             prediction.prediction_win_first,
             prediction.prediction_win_second
           ];
           percentages.sort();
           if (percentages.indexOf(value) === 1) {
             return "main-prediction";
           }
    
           return '';