【问题标题】:How to bind the json objects with the grouping of same elements in angular如何将json对象与角度中相同元素的分组绑定
【发布时间】:2018-10-01 07:03:49
【问题描述】:

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","position":"TEAM_MEMBER","mode_of_employement":"Direct","phoneNumber":"9087881162","email":"amanullah.h@binary2quantum.com","date_of_joining ":"14-02-2018","re​​portManager":"sampath.m@binary2quantum.com","image":"aman.jpg","userRole":"EMPLOYEE","appUser":7,"department ":"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","re​​portManager":"sampath.m@binary2quantum.com","image":"anns.jpg","userRole":"EMPLOYEE" ,"appUser":6,"department":"JAVA"},"date":"27-09-2018","status":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","re​​portManager":"sampath.m@ binary2quantum.com","image":"aman.jpg","userRole":"EMPLOYEE","appUser":7,"department":"JAVA"},"date":"28-09-2018", "status":true},{"id":2,"empid":{"userid":6,"firstName":"Anns Jarigo","lastName":"PaulRaj","jobTitle":"JAVA_DEVELOPER", "职位":"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,"department":"JAVA"},"date" :"28-09-2018","status":true},{"id":3,"empid":{"userid":8,"firstName":"Raj Prabhu","lastName":"A" ,"jobTitle":"JAVA_DEVELOPER","position":"TEAM_MEMBER","mode_of_employement":"Direct","phoneNumber":"9087881162","email":"rajprabu.a@binary2quantum.com","date_of_joining" :"26-07-2018","re​​portManager":"sampath.m@binary2quantum.com","image":"raj.jpg" ,"userRole":"EMPLOYEE","appUser":8,"department":"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" ,"电话号码":"9087881162","电子邮件":"rudra.r@binary2quantum.com","date_of_joining":"06-09-2017","re​​portManager":"sampath.m@binary2quantum.com","图片":"rudra.jpg","userRole":"EMPLOYEE","appUser":5,"department":"DOTNET"},"date":"28-09-2018","status":true} ]},"status":"成功!"}

【问题讨论】:

  • 发布json数据而不是图片??
  • 当然!!我用数据更新了我的帖子请提前给我一个解决方案谢谢

标签: json angular datatables


【解决方案1】:

为此使用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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-23
    • 1970-01-01
    • 2019-07-06
    • 1970-01-01
    • 1970-01-01
    • 2021-08-12
    • 1970-01-01
    • 2012-03-23
    相关资源
    最近更新 更多