K
K
kachurinets2018-07-10 18:39:38
JavaScript
kachurinets, 2018-07-10 18:39:38

How to properly organize the output of data in a table?

There is a table in which lists of streets are deduced. The full_name field corresponds to the street name. Also in this table there are fields county, district, us. punk etc

```json
{
    "status": "success",
    "data": {
        "items": [
            {
               "id": "551675",
               "region_id": "3",
               "glob_id": "7a968401-982b-4c6b-8e78-dd90bd303803",
               "full_name": "Цветная",
               "parents_names": null,
               "parents_levels": null,
               "is_edited": "0"
           },
           {
               "id": "551676",
               "region_id": "50",
               "glob_id": "c83a4774-3c18-4a26-b872-7c2413ed037e",
               "full_name": "сектор 4",
               "parents_names": "["Московская", "Орехово-Зуевский", "Большая Дубна", "ДНТ Старт-2"]",
               "parents_levels": "["1", "3", "6", "65"]",
               "is_edited": "0"
           },
        ],
        "page": "2",
        "pageSize": "2",
        "totalPages": 136,
        "totalCount": "271"
    }
}

In parents_names comes a list of parent addresses to which this street belongs. In the component, this response from the server is written to the addressesList variable (corresponds to data.items ). In the template, I display the list of streets using *ngFor="let item of addressesList" and then specify {{item.full_name}} in the required column.
Everything works fine, but I need to fill in other parent columns (county, district, settlement, etc. ). In "parents_levels" it is shown what type exactly comes (fias levels), and in parents_names a list of all parental addresses. How can I correctly display this data from the array and display it in a table? It should also be borne in mind that some levels may not come

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question