question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception using dynamic module in wildcard route (**)

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior If I try to load a dynamic Module as wildcard, I get a null pointer exception:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';

import { AppComponent } from './app.component';

@NgModule({
    imports: [
        BrowserModule,
        RouterModule.forRoot([
                        { path: '', redirectTo: 'login', pathMatch: 'full' },
            { path: 'login', loadChildren: 'app/login/login.module#LoginModule' },
            { path: 'not-found', loadChildren: 'app/not-found/not-found.module#NotFoundModule' },
            { path: '**', redirectTo: 'not-found', pathMatch: 'full' }
        ])
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

This is the error I get: handleError — core.umd.js:3370EXCEPTION: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'route._loadedConfig.routes')

Minimal reproduction of the problem with instructions Here you can find a ready project

  • Angular version: 2.0.1
  • Browser: [all]
  • Language: [all]
  • Node (for AoT issues): node --version = 6.6

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
tskwerescommented, May 15, 2017

I am still unable to lazyload wildcard “**” routes in Angular 4.x, is this fixed somewhere?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 11, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set router wildcard exceptions in an Angular 9 app?
You can set exceptions to the wild-card route by adding the components which needed to be excluded or excepted above the wild-card route...
Read more >
Dynamic argument replacement (wildcard) | Drupal.org
When calling comment_reply , the 2 in the arguments array will be replaced by node_load(arg(2)) . The function name is the name of...
Read more >
Router tutorial: tour of heroes - Angular
A wildcard route can navigate to a custom "404 Not Found" component or redirect to an existing route. The router selects the route...
Read more >
Dynamic imports solve all the problems, right? - Minko Gechev
We specify the path as a string literal but we use a wildcard import. In this scenario, in the general case the bundler...
Read more >
ASP.NET Core Blazor routing and navigation - Microsoft Learn
For the URL /catch-all/this/is/a/test with a route template of /catch-all/{*pageRoute} , the value of PageRoute is set to this/is/a/test .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found