Detect if a popover was dismissed from a different page

HI everyone :slight_smile:

I have a page ‘pre-order’ that iterates through a list. For each item in this list it uses a custom component I wrote:

      <div *ngFor="let item of getConsumable(slide.id)">
          <div class="abc">
              <ion-item  *ngIf="item.name.toLowerCase().indexOf(searchBar.toLowerCase()) >= 0">
                  <consumable-item [menuItem]="item"></consumable-item>
                </ion-item>
          </div>
      </div> 

This component has a click event that opens up a popover with the item’s details.

Now on the same page, where I iterate through the item list (pre-order), I have a searchbar.
I want to clear out the input of the searchbar when the popover gets dismissed. How can I do this in the typescript file for ‘pre-order’?

I would suggest you use events.
Subscribe to it on your pre-order page and broadcast them when a popup is dismissed.

1 Like

That’s what I did :slight_smile:

I just thought, that there might be a cleaner way, like using viewcontroller or something. I’m just not familiar with the advanced Ionic navigation stuff. I somehow don’t get it :frowning:

Another solution would be to have a custom event on cosumable-item which returns the popover.
Using this event, you can trigger the dismiss when it is necessary in the pre-orderpage.

1 Like