ExamList.Controller.js 792 Bytes
Newer Older
Thitichaipun Wutthisak committed
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 34
'use strict'

angular.module('EXAM').controller('ExamList', ['$scope', '$http', 'GETLANG', 'EXAMSERVICES', function($scope, $http, GETLANG, EXAMSERVICES){
  $scope.examlist = []
  EXAMSERVICES.ManageExamList.query().$promise.then(function(result){
    $scope.examlist = result.exam
  })

  $scope.swlang = GETLANG

  $scope.getString = function(obj){
    let str = '';
    if (getLang() === 'eng'){
      str = obj.eng
    } else if (getLang() === 'tha'){
      str = obj.tha
    }
    return str
  }

  $scope.goPage = function(exid){
    angular.element($('input[name="__examid"]').val(exid))
    $('form[name="cscform"]').submit()
  }

  $scope.sortByExamId = (exam) => {
    return parseInt(exam.examid)
  }

  $scope.orderByExamId = (exam) => {
    return parseInt(exam.examid)
  }

}])