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.

Router's navigate() throws exception for component has no route config (in Alpha 38)

See original GitHub issue

Just tried alpha 38 … found a few minor things, but this one is confusing on the router. We can now use navigate or navigateByUrl/ The latter accepts a string (the old style) and works. The former accepts a tuple, and tosses an error at me.

  // this works
  this._router.navigateByUrl(`detail/${this.selectedHero.id}`);

  // this does not work
  this._router.navigate([`./${Routes.detail.as}`, {id: this.selectedHero.id}]);

The error is ORIGINAL EXCEPTION: Component "HeroesComponent" has no route config.

See example here

https://github.com/johnpapa/angular2-tour-of-heroes/blob/master/src/app/heroes.component.ts#L38-L39

cc/ @btford:

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
btfordcommented, Oct 7, 2015

Yes– / means relative to the root of the application, and ./ means a child of this component.

So this is expected behavior, but the exception here could be a bit better.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 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

Component has no route config. in Component - Angular 2 ...
You're bootstraping the wrong component. Your root component is LoginComponent therefore when you write /SomeComponent (absolute path) it will start from ...
Read more >
48 answers on StackOverflow to the most popular Angular ...
Angular EXCEPTION: No provider for Http; Can't bind to 'formGroup' ... The router will remove this component from the DOM and destroy it....
Read more >
export 'useroutematch' (imported as 'useroutematch') was not found ...
however, I get this error: export 'useNavigation' (imported as 'useNavigation') was not found in 'react-router-dom' (possible exports: BrowserRouter, ...
Read more >
Attribute Routing in ASP.NET Web API 2 | Microsoft Learn
This topic discusses how to enable attribute routing in ASP.NET Web API 2 and describes various options for attribute routing.
Read more >
Router tutorial: tour of heroes - Angular
Configure the router module with RouterModule.forRoot(); Set the router to compose HTML5 browser URLs; Handle invalid routes with a wildcard route; Navigate to ......
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