angular--ngResource的簡單使用

service.factory('domainResource',function($resource){
    return $resource('/domainsInfo/:id',{id:'@id'})
});
service.factory('resultset',function($resource){
    return $resource('/resultset/:key/:objName',{key:'@key',objName:'@objName'})
});
service.factory('objValuesResult',function($resource){
    return $resource('/objValuesResult/:key/:property/:valueBlob',{key:'@key',property:'@property',valueBlob:'@valueBlob'})
});
service.factory('test',function($resource){
    return $resource('/test',{})
});

得到data:javascript

$scope.KeyObjects =resultset.query({key:key});

 存:java

      var updateOneRecord = new resultset({});

      updateOneRecord['key'] = resu.key;
      updateOneRecord['objectid'] = resu.objectid;
      updateOneRecord['column'] = resu.column; 
      updateOneRecord['property'] = resu.property; 
      updateOneRecord['labels'] = $scope.labelMap;
      updateOneRecord['values'] = $scope.valueMap;
      resultset.save(updateOneRecord);

刪除:dom

      var delMyRecord = new resultset({key:resu.key,objName:resu.column});
       resultset.delete(delMyRecord);
相關文章
相關標籤/搜索