Application is not navigating to proper page

In my app when I am pressing back button from Navbar or hardware back button then page is not navigating to proper page.

Stackblitz url:

Please click on the above url then click on Hamburger icon. From menu click on Page B >> Page C. Now navigate back using Navbar back button, you will see it navigates back to the root page instead of navigating to Page B. Also in url if you notice it’s showing pageB in end but showing content of root page not of page B.

This issue I am facing in my live application. So I created POC project and checked everything on sample application then everything was ok. But when I started merging my code then issue started to come again.

Can anyone please help me on this.

Please change your const routes variable in app-routing.module.ts like below. It worked on you shared domain.

const routes: Routes = [
     path: '',
     redirectTo: 'folder/Inbox',
     pathMatch: 'full'
     path: 'folder/:id',
     loadChildren: () => import('./folder/folder.module').then( m => m.FolderPageModule)
   {path: 'pageA', component: PageAComponent},
  {path: 'pageB', component: PageBComponent},
  {path: 'pageC', component: PageCComponent},
  {path: '', component: LandingPageComponent, pathMatch: 'full'}

I have tried and tested with the suggested changes but still no result. It navigates to root page only instead of PageB.