Remove page html from Dom when page is not active

Hello everyone,
There is a way that the page html will not be in Dom when page are not active?

What happens not is each page i open is add his Html to Dom its not good for performance

Pop pages off the nav stack when you aren’t using them.

If i will pop off the pages the history stack removed.
I want to keep history

You could store the history in a provider. Or you could clean up your page in ionViewWillLeave.

How do i clean up my page?
Any example?

Pages are not in the dom when they are not shown, per mechanism of angular

So your question may need to be rwphrased to express what you are trying to clean and moreover: why?

Much of garbage collection, loading and dom handling is within angular or even js

Unsubscribe from all Observables, for example. Disconnect change detection (though that can be dagerous-ish). It depends on why your pages are not performant. But these steps are probably unnecessary if you refactor. I don’t think this is an inherently Ionic/Angular problem. Something you are doing is costing more than it needs to.