Array in reverse order


#1

In my ionic project i display some data from native storage.it displays in first in first order.i want to display that in last stored data at first.

  <ion-card *ngFor="let asd of FullDetails; let k=index" style="border: 2px solid #9D9D9D;border-radius: 10px" >
<ion-card-content >
      <p style="font-size: 22px;">{{airline_name[k]}}</p>
      <div class="row" style="border-bottom:0px">
        <div class="col" style="font-size: 25px;width: 25%">{{departure_fscode[k]}}</div>
        <div class="col" style="padding-top: 10px;width: 50%!important;"><img src="assets/statusicon/arrive_onTime.png"></div>
        <div class="col" style="text-align: right;font-size: 25px;width: 25%">{{arrival_fscode[k]}}</div>
      </div>
      <label style="padding-left: 40px;color: #008000">{{asd.status | statusupdator}}</label><label style="padding-right: 5px;padding-left: 5px;">-</label><label>departs in 2 hr 4mins</label>

#2

Do an array.sort on this.FullDetails


#3

or you could also reverse your array, it’s a default javascript function, after grabbing them from your storage

this.storage.get('my_array').then((result) => {
      this.fullDetails = result.reverse(); // <-- Here reverse the array
});

P.S.: And if I may, did you notice that your variable FullDetails begin with a capital letter?