title: How to get enum value in angular js with a response data
body: <p>I have a problem, I confused to get enum value in angular js. Oke, I have table list, the column 'Criteria Type' there are two values from mysql : 'C' is Cost and 'B' is Benefit. But my table list just display "C" or "B". So, how can i get/make enum value by initial string 'C' to be Cost and 'B' to be benefit?
  Here my code controller :</p>
  
  <pre><code> adminService.get('kriteria').then(function(response){
      $scope.datas = response.data;
  });
  </code></pre>
  
  <p>and here my display data table code :</p>
  
  <pre><code>&lt;div class = "panel-body"&gt;
              &lt;div id="add-button"&gt;&lt;a href="#!/kriteria/0" class="btn btn-primary" style="margin:5px 5px 5px 10px"&gt;Tambah Kriteria&lt;/a&gt;&lt;/div&gt;
              &lt;table class="table table-striped"&gt;
                  &lt;thead&gt;&lt;tr&gt;&lt;th&gt;No&lt;/th&gt;&lt;th&gt;Code Kriteria&lt;/th&gt;&lt;th&gt;Nama Kriteria&lt;/th&gt;&lt;th&gt;Criteria Type&lt;/th&gt;&lt;th&gt;Skala Kepentingan&lt;/th&gt;&lt;th&gt;Proses&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
                  &lt;tbody&gt;&lt;tr ng-repeat="(v,i) in datas"&gt;&lt;td&gt;{{v+1}}&lt;/td&gt;&lt;td&gt;{{i.kd_kriteria}}&lt;/td&gt;
                      &lt;td&gt;{{i.nama_kriteria}}&lt;/td&gt;&lt;td&gt;{{i.jenis_kriteria}}&lt;/td&gt;&lt;td&gt;{{i.id_skala}}&lt;/td&gt;&lt;td&gt;&lt;a href="#!/kriteria/{{i.id_kriteria}}"&gt;Edit&lt;/a&gt; |
                          &lt;a href="" ng-click="delete(i.id_kriteria)"&gt;Hapus&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
              &lt;/table&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Code Service :</p>
  
  <pre><code>/** adminControl Service **/
  app.service('adminService', ['$http', '$route', function($http, $route){
      var links = "./services/";
  
      this.get = function(url){
          return $http({
              method:'GET',
              url:links + url,
              headers: {'Content-Type': 'application/json; charset=utf-8'},
              dataType: 'json'
          });
      }
  
      this.post = function(url,data){
          return $http({
              method:'POST',
              url:links + url,
              headers: {'Content-Type': 'application/json; charset=utf-8'},
              dataType: 'json',
              data: data
          });
      }
  
      this.update = function(url,data){
          return $http({
              method:'UPDATE',
              url:links + url,
              headers: {'Content-Type': 'application/json; charset=utf-8'},
              dataType: 'json',
              data: data
          });
      }
  
      this.delete = function(url) {
          return $http({
              method: 'DELETE',
              url: links + url,
              headers: {'Content-Type': 'application/json; charset=utf-8'},
              dataType: 'json'
          });
      }
  
      this.getReload = function(url){
          $route.reload();
          location.href=url;
      }
  }]);
  </code></pre>
  
  <p>And my API in php code :</p>
  
  <pre><code>function kriteria(){
          switch($this-&gt;get_request_method()){
              case "GET":
                  if(!isset($_GET['id'])){
                      $result = NULL;
                      $sql = $this-&gt;pdo-&gt;prepare("SELECT * FROM tbl_kriteria, tbl_skala
                                                  WHERE tbl_kriteria.id_skala = tbl_skala.id_skala ORDER BY 1 DESC");
                      $sql-&gt;execute();
                      while($r = $sql-&gt;fetch(PDO::FETCH_ASSOC)){
                          $result[] = $r;
                      }
                      return $this-&gt;response($this-&gt;json($result));
                  }else{
                      $result = NULL;
                      $sql = $this-&gt;pdo-&gt;prepare("SELECT * FROM tbl_kriteria
                                                  WHERE id_kriteria = '".$_GET['id']."'
                                                  ORDER BY 1 LIMIT 1");
                      $sql-&gt;execute();
                      if($sql-&gt;rowCount()){
                          $r = $sql-&gt;fetch(PDO::FETCH_ASSOC);
                          $result = $r;
                          return $this-&gt;response($this-&gt;json($result));
                      }
                  }
                  break;
              case "POST":
                  $data = json_decode(file_get_contents("php://input"),true);
                  $sql = $this-&gt;pdo-&gt;prepare("INSERT INTO tbl_kriteria (id_skala, kd_kriteria, nama_kriteria, jenis_kriteria)
                                              VALUES (:id_skala, :kd_kriteria, :nama_kriteria, :jenis_kriteria)");
                  $sql-&gt;bindParam(':id_skala', $data['id_skala']);
                  $sql-&gt;bindParam(':kd_kriteria', $data['kd_kriteria']);
                  $sql-&gt;bindParam(':nama_kriteria', $data['nama_kriteria']);
                  $sql-&gt;bindParam(':jenis_kriteria', $data['jenis_kriteria']);
                  $sql-&gt;execute();
                  break;
              case 'DELETE':
                  $sql = $this-&gt;pdo-&gt;prepare("DELETE FROM tbl_kriteria WHERE id_kriteria = '".$_GET['id']."'");
                  $sql-&gt;execute();
                  break;
              case 'UPDATE':
                  $data = json_decode(file_get_contents("php://input"),true);
                  $sql = $this-&gt;pdo-&gt;prepare("UPDATE tbl_kriteria set kd_kriteria = '".$data['kd_kriteria']."',
                                              nama_kriteria = '".$data['nama_kriteria']."', jenis_kriteria = '".$data['jenis_kriteria']."'
                                              id_skala = '".$data['id_skala']."' WHERE id_kriteria = '".$data['id_kriteria']."'");
                  $sql-&gt;execute();
                  break;
          }
      }
  </code></pre>