swaplang.factory.js 728 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
'use strict'

angular.module('myHR').factory('SwapLang', ['$mdDialog', function($mdDialog){
  return {
    getString: function(obj){
      let str = ''
      if (obj != undefined){
        str = obj[getLang()]
      }
      return str
    },
    getAlert: function(alertcode, textContent){
      let alert = $mdDialog.alert()
        .clickOutsideToClose(true)
        .title(MyCode[alertcode])
        .textContent(textContent)
        .ok(MyCode[242])
      return $mdDialog.show(alert)
    },
    getConfirm : function (alertcode) {
       let confirm = $mdDialog.confirm()
           .title(MyCode[alertcode])
           .ok(MyCode[240])
           .cancel(MyCode[241]);
       return $mdDialog.show(confirm)
    }
  }
}]);