How to use provider in app.component.ts in sidemenu start up project

I’m using firebase and providers works will in other page the problem is that when I get data I couldn’t unsubscripte to observables , I have tried async pipe then I haved used Other ways such as takeWhile and takeUntile rxjs/OperatorsI have used them in OnInit and OnDestroy it doesn’t work . also I used ionViewDidLoad and ionViewWillLeave as an alternative for ngOnInit and ngOnDestroy but it does not work . please help !! What I should do ? thanks in advance .