I have a json array and I want to create a table from this and want to give a header which is an element of the array. Here is the fiddle showing the script.
<div ng-repeat="products in items"> <div>{{products.IDTYPE}}</div> <div> <table border=1> <thead> <th>primkey</th> <th>userid</th> </thead> <tbody> <tr> <td>{{products.PRIMKEY}}</td> <td>{{products.USERID}}</td> </tr> </tbody> </table> </div>
This will create a simple table with a header from IDTYPE. But I want to group rows with a unique IDTYPE. Therefore, the desired table will be shown in this link .
So, I tried to add the condition ng-show ng-show="$index==0 || items[$index-1].IDTYPE!=items[$index].IDTYPE" , but it does not work properly, as tbody and table will be built for each row. This one is what I tried.
So how to create a table as I wanted in the above description?
source share