从JSON feed Angular 4中的表中检索数据

时间:2018-07-05 08:59:14

标签: javascript json angular

我有一个返回此结果的函数:

    {id: 20, dateCreation: 1517324655450, auteurCreation: "bel", dateModification: 1530544886148, auteurModification: "user", …}
    auteurCreation:"bel"
    auteurModification:"user"
coupesTechniquesDescription:Array(1)
0:{id: 15, hauteurReference: 2, commentaireReference: "test"}
length:1
__proto__
:Array(0)
dateCreation:1517324655450
id:20

我想将coupesTechniquesDescription保存到变量中, 目标是获取coupesTechniquesDescription的列表并使用第一个索引

1 个答案:

答案 0 :(得分:1)

您在这里。从<?php use DataTables\DataTablesInterface; /** * Symfony 3.4 and above * * @Route("/users", name="users") * * @param Request $request * @param DataTablesInterface $datatables * @return JsonResponse */ public function usersAction(Request $request, DataTablesInterface $datatables): JsonResponse { try { // Tell the DataTables service to process the request, // specifying ID of the required handler. $results = $datatables->handle($request, 'users'); return $this->json($results); } catch (HttpException $e) { // In fact the line below returns 400 HTTP status code. // The message contains the error description. return $this->json($e->getMessage(), $e->getStatusCode()); } } /** * Symfony 3.3 and below * * @Route("/users", name="users") * * @param Request $request * @return JsonResponse */ public function usersAction(Request $request): JsonResponse { try { /** @var \DataTables\DataTablesInterface $datatables */ $datatables = $this->get('datatables'); // Tell the DataTables service to process the request, // specifying ID of the required handler. $results = $datatables->handle($request, 'users'); return $this->json($results); } catch (HttpException $e) { // In fact the line below returns 400 HTTP status code. // The message contains the error description. return $this->json($e->getMessage(), $e->getStatusCode()); } } 中获取对象:

res