I\'m using \"@ionic/angular\": \"^4.11.10\"
I\'m trying to display the tabs in ion-tabs
in ion-tab-bar
depending on whether an eve
To update Data from one page to other we used Events library. but events are no longer available in ionic 5. blow is the solution. run command:
ionic generate service events // this will create events provider
copy paste blow code.
import { Injectable } from '@angular/core';
import {Subject} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class EventsService {
private fooSubject = new Subject<any>();
constructor() { }
publishLogin(data: any) {
this.fooSubject.next(data);
}
receiveLogin(): Subject<any> {
return this.fooSubject;
}
}
From Page A: import your service initialize it in constructor //
constructor(public events: EventsService){}
and publish event E.g.
this.events.publishLogin(yourDataVariable);
Receive it in Page B: import your service initialize it in constructor //
constructor(public events: EventsService){}
this.events.receiveLogin().subscribe((res:any)=>{
console.log(res);
})