繁体   English   中英

如何在 mat-table 中显示下拉列表,然后根据 typescript 中的下拉选择选项显示其他列?

[英]How to display dropdown in mat-table and then display other columns based on dropdown selected option in typescript?

假设这是我的 api 响应-

我需要使用 for 循环将 followUpLists 分配给 FollowList 数组吗? 我如何在 typescript 中编写 for 循环?

{
  "Info": [
    {
      "CustomerId": "3",
      "CustomerName": "Sreejesh Panayappilly ",
      "followUpLists": [
        {
          "CustomerId": "3",
          "CustomerName": "Sreejesh Panayappilly ",
          "ProductName": "OLT - GPON - V1600G0 - 4 PON PORT",
          "MacId": "14A72BA2AFF2",
          "AMCStartDate": "0001-01-01T00:00:00",
          "AMCEndDate": "0001-01-01T00:00:00",
          "AMCStatus": 1,
          "FollowStatus": 0
        },
        {
          "CustomerId": "3",
          "CustomerName": "Sreejesh Panayappilly ",
          "ProductName": "OLT - GPON - V1600G1 (B) - 8 PON PORT",
          "MacId": "14A72BF09C40",
          "AMCStartDate": "0001-01-01T00:00:00",
          "AMCEndDate": "0001-01-01T00:00:00",
          "AMCStatus": 1,
          "FollowStatus": 0
        }
      ]
    },
    {
      "CustomerId": "5",
      "CustomerName": "Priyamvadan",
      "followUpLists": [
        {
          "CustomerId": "5",
          "CustomerName": "Priyamvadan",
          "ProductName": "OLT - GPON - V1600G1 (B) - 8 PON PORT",
          "MacId": "14A72BF09B8C",
          "AMCStartDate": "0001-01-01T00:00:00",
          "AMCEndDate": "0001-01-01T00:00:00",
          "AMCStatus": 1,
          "FollowStatus": 1
        }
      ]
    },
 ],
  "Status": true,
  "Message": "Data Collected Successfully."
}

我需要使用 for 循环将 followUpLists 数组分配给 FollowList 数组吗? 我如何在 typescript 中编写 for 循环?

也许尝试:

const FollowList = [];
yourObject.Info.map(e => FollowList.push(...e.followUpLists));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM