Skip to content

Refactor: Improve routing structure for standalone and module-based components #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlanMelendez
Copy link

Refactored Routing to Support Standalone Components

Summary of Changes

  • Refactored routing to properly nest components inside LayoutComponent.
  • Ensured support for both standalone components and lazy-loaded modules.
  • Updated wildcard redirect to maintain consistency.
  • No need to use modules and routing modules to add new components—standalone components can be integrated directly.

Adding More Components is Easy

Just use loadComponent like this:

const routes: Routes = [
  {
    path: '',
    component: LayoutComponent,
    children: [
      {
        path: 'dashboard',
        loadChildren: () => import('../dashboard/dashboard.module').then(m => m.DashboardModule),
      },
      {
        path: 'components',
        loadChildren: () => import('../uikit/uikit.module').then(m => m.UikitModule),
      },
      {
        path: 'new-feature',
        loadComponent: () => import('../new-feature/new-feature.component').then(m => m.NewFeatureComponent),
      }
    ],
  },
  { path: '**', redirectTo: 'error/404' },
];

@lannodev
Copy link
Owner

Hello Alan Melendez, 👋
Please check the preview of your PR on Vercel: https://angular-tailwind-ekhv45qjx-lannos-projects.vercel.app/

Your changes will break the application.

Note: The main route should be the dashboard module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants