Hi guys, please your help with a problem I have. I'm loading routes from a 
DB through a web service and everything work as expected when using links 
to those routes. But when I refresh the page or I write directly the url in 
the adress bar the route does not work, why?

1) In the "app.component.ts" constructor I call a function that loads the 
routes

  async loadRoutes() {
    await this.configService.cargarRutasMenu(() => {
      for (const item of this.configService._rutas) {
          this.router.config.unshift({ path: item.path, loadChildren: () => 
FormdinamicoModule });
      }
    });
  }

2) Errors in the browser when trying to access the "testing" route

Router Event: NavigationStart
NavigationStart(id: 1, url: '/testing')
NavigationStart {id: 1, url: "/testing", navigationTrigger: "imperative", 
restoredState: null}
Router Event: NavigationError
NavigationError(id: 1, url: '/testing', error: Error: Cannot match any 
routes. URL Segment: 'testing')
NavigationError {id: 1, url: "/testing", error: Error: Cannot match any 
routes. URL Segment: 'testing' at ApplyRedirects.push../node_modules/@an…}
error: Error: Cannot match any routes. URL Segment: 'testing' at 
ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL 
Segment: 'testing'
Error: Cannot match any routes. URL Segment: 'testing'
...

Thank you very much.

Node: 8.12.0
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.3.3
typescript                        2.7.2
webpack                           4.9.2

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to