如何从这个对象数组中获取内部数组数据

时间:2018-03-22 05:19:14

标签: angularjs codeigniter

Data from the server side

我需要从这个对象数组中仅获取tax数组。这怎么可能 ?我怎么能写控制器&模特。

$http.post("/ci/index.php/invoiceCtrl/addInvoice", $scope.invoice).then(function (response).{});

1 个答案:

答案 0 :(得分:0)

假设您正在使用angularjs并希望从响应对象中获取tax数组

$http.post("/ci/index.php/invoiceCtrl/addInvoice", $scope.invoice).then(onSuccess,onError);

function onSuccess(response){
  $scope.tax = JSON.parse(response).tax;
 //do whatever you want afterwards
}
function onError(error){
//error callback
}
相关问题