如何将用Angular

时间:2018-10-01 07:03:49

标签: json angular datatables

How to bind these data in datatables at angular 6 for showing the attenance details this really very confusing to me kindly help me to solve this

{“ content”:{“ 27-09-2018”:[{“ id”:5,“ empid”:{“ userid”:7,“ firstName”:“ Amanullah”,“ lastName”:“ H “,” jobTitle“:” JAVA_DEVELOPER“,”位置“:” TEAM_MEMBER“,” mode_of_employement“:”直接“,”电话号码“:” 9087881162“,”电子邮件“:” amanullah.h@binary2quantum.com“,” date_of_joining “:” 14-02-2018“,” reportManager“:” sampath.m@binary2quantum.com“,” image“:” aman.jpg“,” userRole“:” EMPLOYEE“,” appUser“:7,”部门“:” JAVA“},” date“:” 27-09-2018“,” status“:true},{” id“:6,” empid“:{” userid“:6,” firstName“:” Anns Jarigo“,” lastName“:” PaulRaj“,” jobTitle“:” JAVA_DEVELOPER“,” position“:” TEAM_MEMBER“,” mode_of_employement“:” Direct“,” phoneNumber“:” 9087881162“,” email“:” annsjarigo。 p@binary2quantum.com“,” date_of_joining“:” 24-02-2018“,” reportManager“:” sampath.m@binary2quantum.com“,” image“:” anns.jpg“,” userRole“:” EMPLOYEE“ ,“ appUser”:6,“部门”:“ JAVA”},“日期”:“ 27-09-2018”,“状态”:true}],“ 28-09-2018”:[{“ id”: 1,“ empid”:{“ userid”:7,“ firstName”:“ Amanullah”,“ lastName”:“ H”,“ jobTitle”:“ JAVA_DEVELOPER”,“ position”:“ TEAM_MEMBER”,“ mode_of_employ ement“:” Direct“,” phoneNumber“:” 9087881162“,” email“:” amanullah.h@binary2quantum.com“,” date_of_joining“:” 14-02-2018“,” reportManager“:” sampath.m @ binary2quantum.com“,” image“:” aman.jpg“,” userRole“:” EMPLOYEE“,” appUser“:7,”部门“:” JAVA“},” date“:” 28-09-2018“, “ status”:true},{“ id”:2,“ empid”:{“ userid”:6,“ firstName”:“ Anns Jarigo”,“ lastName”:“ PaulRaj”,“ jobTitle”:“ JAVA_DEVELOPER”, “ position”:“ TEAM_MEMBER”,“ mode_of_employement”:“直接”,“电话号码”:“ 9087881162”,“ email”:“ annsjarigo.p@binary2quantum.com”,“ date_of_joining”:“ 24-02-2018”, “ reportManager”:“ sampath.m@binary2quantum.com”,“ image”:“ anns.jpg”,“ userRole”:“ EMPLOYEE”,“ appUser”:6,“ department”:“ JAVA”},“ date” :“ 28-09-2018”,“状态”:true},{“ id”:3,“ empid”:{“ userid”:8,“ firstName”:“ Raj Prabhu”,“ lastName”:“ A” ,“ jobTitle”:“ JAVA_DEVELOPER”,“位置”:“ TEAM_MEMBER”,“ mode_of_employement”:“直接”,“电话号码”:“ 9087881162”,“电子邮件”:“ rajprabu.a@binary2quantum.com”,“ date_of_joining” :“ 26-07-2018”,“ reportManager”:“ sampath.m@binary2quantum.com”,“图像”:“ raj.jpg” ,“ userRole”:“ EMPLOYEE”,“ appUser”:8,“部门”:“ JAVA”},“ date”:“ 28-09-2018”,“ status”:true},{“ id”:4, “ empid”:{“ userid”:5,“ firstName”:“ Rudra”,“ lastName”:“ Vanniyan”,“ jobTitle”:“ DOTNET_DEVELOPER”,“ position”:“ TEAM_LEADER”,“ mode_of_employement”:“ Direct” ,“ phoneNumber”:“ 9087881162”,“电子邮件”:“ rudra.r@binary2quantum.com”,“ date_of_joining”:“ 06-09-2017”,“ reportManager”:“ sampath.m@binary2quantum.com”,“ image“:” rudra.jpg“,” userRole“:” EMPLOYEE“,” appUser“:5,”部门“:” DOTNET“},” date“:” 28-09-2018“,” status“:true} ]},“状态”:“成功!”}

1 个答案:

答案 0 :(得分:0)

为此使用object.keys

Stackblitz Demo

object=Object;
  data={  
   "content":{  
      "27-09-2018":[ 
        -----
      ]
   }
 }


<div *ngFor="let key of object.keys(data.content)">
  <p>{{key}}</p>
    <div *ngFor="let keyArray of data.content[key]">
    {{keyArray.empid.firstName}}
    </div>
</div>