I'm writing an app on TypeScript I am using JSON array like:
data = [{"name":"dog",
"line":1,
"order":1},
{"name":"cet",
"line":1,
"order":2},
{"name":"red",
"line":2,
"order":1},
{"name":"green",
"line":2,
"order":2},
{"name":"elephant",
"line":1,
"order":3}]
I want to group the array by "line" and sort in ascending order and each object in "line" sort by "order" and display it on the HTML page such that each "line" will be in a separate row .
<div *ngFor="let d of data" >
<div *ngFor="" class= "row">
<span >{{d.name}}</span>
<div>
<div>
What is the best way to group and sort and then view?