8000 Broken example of lazily loaded components in the routes documentation · Issue #62619 · angular/angular · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Broken example of lazily loaded components in the routes documentation #62619
Closed
@joaodasilva

Description

@joaodasilva

Describe the problem that you experienced

The example code at https://angular.dev/guide/routing/define-routes#lazily-loaded-components doesn't build:

export const routes: Routes = [
  // The HomePage and LoginPage components are loaded lazily at the point at which
  // their corresponding routes become active.
  {
    path: 'login',
    loadComponent: () => import('./components/auth/login-page')
  },
  {
    path: '',
    loadComponent: () => import('./components/home/home-page')
  }
]

The problem is that import('./components/auth/login-page') resolves to the module, not to a Component class.

A possible fix is:

loadComponent: () => import('./components/auth/login-page').then(m => m.LoginPage)

Enter the URL of the topic with the problem

https://angular.dev/guide/routing/define-routes#lazily-loaded-components

Describe what you were looking for in the documentation

No response

Describe the actions that led you to experience the problem

No response

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here


If the problem is browser-specific, please specify the device, OS, browser, and version


Provide any additional information here in as much as detail as you can


Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsRelated to the documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0