my goal is to separate desktop and mobile page. The reason is that the desktop page UX flow is "scroll to section". Meanwhile, the mobile page UX flow is "navigate to the next section".
The problem:
- The
desktopuser will loadmobilepage. Same goes for themobileuser.
This is the visual diagram of the current solution:
- there is a
mainpage andget-device-typeservice. - the
mainpage will render thedesktoppage or themobilepage.
What I've tried:
- use
canLoadfordesktoppage.
My expectation:
- When the
desktopuser visit pathcheckout/1, it will load thedesktoppage. - When the
mobileuser visit pathcheckout/1, it will not load thedesktoppage but instead load themobilepage.
My actual result:
- When the
desktopuser visit pathcheckout/1, it will load thedesktoppage. - When the
mobileuser visit pathcheckout/1, it will not load any page.
checkout-page-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { IsDesktopGuard } from '../../../domain/usecases/is-desktop/is-desktop.guard';
const routes: Routes = [
{
path: '',
loadChildren: () => import("../checkout-scroll-page/checkout-scroll-page.module").then(m => m.CheckoutScrollPageModule),
canLoad: [IsDesktopGuard]
},
{
path: '',
loadChildren: () => import("../checkout-navigate-page/checkout-navigate-page.module").then(m => m.CheckoutNavigatePageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class CheckoutPageRoutingModule { }