How could i display a json object into an ionic list grouping by an item ( villearrive in my case ):i would like that items will be grouping by ( villearrive) , the actual problem that , for example villearrive “A” is repeated in the result ( it must be appear Only once , below is my json object :
{“FileS”:[{“matricule”:“AA-001-AA”,“villearrive”:“A”,“marque”:“Fiat”,“climatisation”:“1”,“nbrplacereserve”:“3”,“dateenregistrement”:“31/03/2017”},{“matricule”:“AA-001-AB”,“villearrive”:“A”,“marque”:“Fiat”,“climatisation”:“1”,“nbrplacereserve”:“3”,“dateenregistrement”:“31/03/2017”},{“matricule”:“AA-001-00”,“villearrive”:“A”,“marque”:“Fiat”,“climatisation”:“1”,“nbrplacereserve”:“3”,“dateenregistrement”:“31/03/2017”},{“matricule”:“Aj-001-A0”,“villearrive”:“A”,“marque”:“Fiat”,“climatisation”:“1”,“nbrplacereserve”:“3”,“dateenregistrement”:“31/03/2017”},{“matricule”:“AA-001-CG”,“villearrive”:“A”,“marque”:“Peugeot”,“climatisation”:“0”,“nbrplacereserve”:“3”,“dateenregistrement”:“31/03/2017”},{“matricule”:“AA-001-A0”,“villearrive”:“B”,“marque”:“Fiat”,“climatisation”:“0”,“nbrplacereserve”:“5”,“dateenregistrement”:“31/03/2017”},{“matricule”:“AA-051-AA”,“villearrive”:“B”,“marque”:“Fiat”,“climatisation”:“0”,“nbrplacereserve”:“5”,“dateenregistrement”:“31/03/2017”}],“success”:1}
the json object is the result of a web service ; here is the fucntion that returns the result :`RetournerdVoituresEnstation(){
this.voitureservice.getDetailsVilleArrive().subscribe(response => {
this.itemsFile =response.FileS;
});text`
}
and that is the html
<ion-item-group *ngFor="let pr of itemsFile">
<ion-item-sliding >
<ion-item class="item-checkbox-right">
<ion-thumbnail item-left>
<img src="assets/icon/louage.png">
</ion-thumbnail>
<ion-item-divider color="danger" >{{pr.villearrive}} </ion-item-divider>
<h2>{{pr.matricule}}</h2>
<h3>{{pr.marque}}</h3>
<h3>{{pr.climatisation}}</h3>
<h3>{{pr.nbrplacereserve}}</h3>
<h3>{{pr.dateenregistrement}}</h3>
</ion-item>
</ion-item-sliding>
</ion-item-group>