How to pass data between tabs in Ionic

There are several way you could achieve this.

  1. Events would be the right choice when it comes to passing data between different pages.

    Events is a publish-subscribe style event system for sending and responding to application-level events across your app.

    create an event with

    constructor(public events: Events) {}
    function sendData(data) {
      events.publish('data:created', data);
    }
    

    subscribe to it using

    events.subscribe('data:created', (data) => { console.log( data); });


  1. Use a shared service

    constructor(public shared: Share) {} pushData(data){ this.shared.items.push(data); }

    You can access items in other components using this.shared.items when you inject the service globally in app.module.ts


  1. Another option would be to use segments instead of tabs. This depends on the use case. For simple applications, this would be the better solution. You can learn more from the documentation.

Edit

I have avoided storing the data in database as its not an efficient way to do this. But there may be use cases for such an approach.