ngFor Problem Ionic


Hey, i am getting some data from a JSON URL, you could see it below,

Here “cname” is "Geriatrics."
I want to print cname only once and then “stitle” under it.
If one has some other cname than “Geriartrics” than it should print that cname and its stitle in it.
Demo Required result,

1). Geriartrics:
Heart Valve Disease
Test 1.

2). Something else
Test 5
Test 8

My JSON url is:

Hope this explains better :slight_smile:


I think you will need to create a new array structure locally to get the desired grouping.


The problem is that i cannot predict the amount of data that would come by this URL. Any suggestions ?


Explore the use of RxJS to manage, filter and parse the data. Good luck!


I use a npm package called sort-by

I created 2 pipes
they use sort-by the property align the data

 <ion-item *ngFor="let item of sortedAllReturn | distinct: {propName: 'name',sortNames:['name']}">

 <ion-item  *ngFor="let subitem of sortedAllReturn | filter: {propName: 'name',propValue:,sortNames:['price'],rows: 0}">

hope that helps