I am totally new to Angular 1, I want to create a table where I am fetching data from an API and displaying it in rows. I don't want to display multiple rows with the same resourceId instead I have thought about creating a drop-down where I'll click and all the rows with similar resourceId will appear.
I have written this code inorder to hide the rows with the same resourceId, but this isn't working because Angular doesn't seem to
support embedding html elements in ternary operators. How can I achieve it?
<tr ng-repeat="report in data">
{{report.resourceId === data[$index-1].resourceId ?
//Empty row
:
<td>{{report.reportId}}</td>
<td>{{report.resourceId}}</td>
<td>{{report.reason}}</td>
}}
</tr>
The data array is like this:
data: [
{
reportId: "12",
resourceId: "16241",
reason: null
},
{
reportId: "18",
resourceId: "26387",
reason: "It is biased or written by someone in the company"
},
{
reportId: "19",
resourceId: "26387",
reason: "It is irrelevant"
}
]