如何定制对不同结构的响应

时间:2019-05-14 06:30:55

标签: angular6

我有这样的答复。

"data": [
        {
            "first_name": "Shiftt",
            "photo": "https://time-tracker-test.s3.us-east-2.amazonaws.com/image_1552991602986.png",
            "des_id": 1,
            "lead_name": "kathir",
            "lead_designation": "Team Lead",
            "designation": "Employee"
        },
        {
            "first_name": "ABABb",
            "photo": "",
            "des_id": 1,
            "lead_name": "kathir",
            "lead_designation": "Team Lead",
            "designation": "Employee"
        },
        {
            "first_name": "Karthi",
            "photo": "",
            "des_id": 6,
            "lead_name": "ABABb",
            "lead_designation": "Employee",
            "designation": "Junior Software Developer"
        }
    ]

以上回复来自邮递员回复。因此,我需要将其自定义为以下格式

 private dataInfo2 = {
    'lead_name': 'Kathir',
    'lead_designation': 'teamlead',
    'children': [
        {
            'first_name': 'Shiftt',
            designation: empolyee
        },
        {
            'name': 'ABABb',
            designation: employee
        }
    ]
};

我正在使用Angular6。我需要使用打字稿

0 个答案:

没有答案