Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic 2 - refresh view without making another service call

$
0
0

@zamorisima wrote:

I’m still novice with Ionic and Angular so please bear with me –

I have a search field in which a user can enter the name of an item or start to type, a list of items with radio buttons appear to select and see related images populate below in the body upon selection. When a radio button is selected, the items are pushed to an array.

  <ion-navbar>
    <ion-searchbar [(ngModel)]="search" (ionInput)="getItems($event)"></ion-searchbar> 
**This ion-list element displays the items to be selected**
      <ion-list id="thingsList">
    <ion-item *ngFor="let item of items">
      <ion-label>{{ item.text }}</ion-label>
      <ion-checkbox id='things' (ionChange)="addToFavs(item)" color="success"></ion-checkbox>
    </ion-item>
  </ion-list>
**This ion-list below shows selected items that can be removed by clicking on trash icon**
  <ion-list>
      <ion-item *ngFor="let item of service.itemDisplay">
        {{ item.text }}
        <ion-icon ios="ios-trash" (click)="trashItem(item)"></ion-icon>
      </ion-item>
   </ion-list>
  </ion-navbar>
...

   <ion-list>
   <ion-row *ngFor="let post of feedService.feed"</ion-row>
</ion-list>

Here is my simplified typescript to run a function in the service provider to remove items:

trashItem() {
    this.service.toggleFavorite(obj); 
}

The associated images with any item are loaded via an API.

MY QUESTION:
After removing any item from the selected array, how can I refresh the page view to remove the associated content WITHOUT making another api call on init?

Thank you.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>