I have this object
{
"id": 1,
"paragraphText": "I'm some Paragraph Text",
"paragraphName": "new paragraph",
"paragraphPlacement": {
"id": 1,
"order": 1
}
}
{
"id": 1,
"paragraphText": "I'm another Paragraph Text",
"paragraphName": "old paragraph",
"paragraphPlacement": {
"id": 1,
"order": 2
}
}
I'm trying to sort it by using the keyvalue pipe.
<div class="col-8">
<div *ngFor="let paragraph of offer.offerContent.paragraphs | keyvalue">
{{paragraph.paragraphName}} : {{paragraph.paragraphPlacement.order}}
As I understand it, keyvalue is expecting a key:value map but the angular documentation says you can use comparefn to compare complex objects, however I can't find any documentation or examples of how to use comparefn. So my question is how do I use comparefn to sort my above example on the "paragraphPlacement:order" value.