Hi we are running from a long time into many many problems using LazyLoading pages in PWA and WebApp.
So perhaps someone of you can help us figure out which is the best approach to do a big heavy app with a lot of pages on a WebApp PWA context.
Let me explain what we are trying to do.
We have our APP.COMPONENT which is only holding the ROOT NAV element. IF we are authenticated we would load our LoginPage if we are not Authenticated we would load our MainPage.
If we can enter LoginPage or should be redirect to MainPage we are handling from ionic guard ionCanEnter.
If we are not authenticated we can load as default page the LoginPage and that is no problem.
If we are logged in we load MainPage.
So MainPage now has an second NAV component, where we would load many of our other pages, like a Dashboard.
A DashboardPage has a segment for IonicPage, like an ID.
So the structure is something like that
-----> Login Page
APP NAV
-----> DashboarPage (segment: id)
-----> Main Page -----> Page2
-----> Page 3
Our Main Problem is handling auth guards where we opened some bugs on github, and handling navigation with URLS.
So if you navigate to
a) /
load Login Page or Main Page, depending on if user authenticated, that is not a problem
b) /loginpage
redirect to MainPage if you are already authenticated
c) /mainpage
redirect to LoginPage if you are not authenticated, if you are authenticated load DashboardPage with default ID segment public
d) /mainpage/dashboard
redirect to Default DasboardPage which is /mainpage/dashboard/public
teorically all this should work very very easy, but there are many many problems with lazyloading, routes and multi level navigation.
So please, share some BEST PRACTICE on how we should do something like that.
thx