出现错误TypeError:订阅时无法读取未定义的属性“ 0”

时间:2020-08-17 13:42:45

标签: angular typescript

尝试订阅端点时出现以下错误。这是我的代码和端点的响应。当我在控制台上记录响应时,它会显示数据。

TS

this.getMemberDetails().subscribe((resp) => {
  console.log(resp.Member[0]);
  this.memberDetails = resp.Member[0];
}

响应数据

{
    "Member": [
        {
            "EmployeeId": "9f0b0c25-5c29-4cd1-beb8-722b09e7d8a2",
            "HrRepresentativeId": "522d6c01-90e4-4259-a848-d7c3716d58bc",
            "EmployeeNumber": "00187021",
            "EmployerName": "@ HOME",
            "ExitDate": "2020-07-28T00:00:00",
            "ExitNoticeDate": "2020-07-28T00:00:00",
            "IdentityValue": "6104060705088",
            "IdentityTypeId": 1,
            "EmployeeUserName": "",
            "Initials": "HH",
            "FirstName": "Hazel",
            "Surname": "Msibi",
            "DateOfBirth": "1961-04-06T00:00:00",
            "TelephoneNumber": "0112690000",
            "MobileNumber": "0844064716",
            "PersonalEmail": "c7f6304a6f@emailmonkey.club",
            "WorkEmail": "",
            "PrimaryEmail": "c7f6304a6f@emailmonkey.club",
            "IsHrEmailAddress": false,
            "IndebtedToEmployer": false,
            "AmountOfDeduction": 0.0,
            "POBox": null,
            "Address1": "122 test",
            "Address2": "abc",
            "Address3": "def",
            "UnitNumber": null,
            "Complex": null,
            "StreetNumber": null,
            "StreetOrFarmName": null,
            "SuburbOrDistrict": null,
            "CityOrTown": null,
            "Country": "SM",
            "PostalCode": "2196",
            "TitleId": 1,
            "GenderId": 1,
            "ModifiedBy": "cicoyos621@x7mail.com",
            "HrRepresentative": {
                "HrRepresentativeId": "522d6c01-90e4-4259-a848-d7c3716d58bc",
                "UserName": "cicoyos621@x7mail.com",
                "EmailAddress": "cicoyos621@x7mail.com",
                "ModifiedBy": "cicoyos621@x7mail.com",
                "FirstName": "xxxxx",
                "LastName": "xxxx"
            },
            "Membership": [
                {
                    "EmployeeMembershipId": 4744,
                    "EmployeeId": "9f0b0c25-5c29-4cd1-beb8-722b09e7d8a2",
                    "FundId": 2421,
                    "FundName": "Standard Bank Group Retirement Fund",
                    "IntegrationSystem": "Conventional",
                    "SubscriptionNumber": "M01532552",
                    "IsHybrid": false,
                    "ModifiedBy": "cicoyos621@x7mail.com",
                    "Gender": null,
                    "Title": null
                }
            ],
            "Exit": {
                "ExitId": "3e768898-ec65-4386-9a20-829f6d6ed079",
                "EmployeeId": "9f0b0c25-5c29-4cd1-beb8-722b09e7d8a2",
                "KickoffDate": "2020-05-13T00:00:00",
                "ActionId": 1,
                "StatusId": 1,
                "StatusDescription": "Started",
                "ActionDescription": "Resignation",
                "ModifiedBy": "6104060705088",
                "OpportunityId": null,
                "ClaimId": 0,
                "RBC": null
            }
        }
    ],
    "IsSuccess": true,
    "Message": "Success"
}

任何想法可能是什么问题?

0 个答案:

没有答案