Incorrect route link parsing in template
See original GitHub issueI’m submitting a … (check one with “x”)
[ x] bug report
Current behavior routerLink parsing is wrong in template: it includes current path.
Expected behavior It should not include current path rather replace it.
Minimal reproduction of the problem with instructions https://plnkr.co/edit/MYoIl9lWwEYLvd9iezh5?p=preview
- Click “
Heroes
” - Click any hero (current route:
/hero/XX/
) - Click any of the “
heroes
” or “/heroes
” or the “/heroes/
” buttons to navigate to those routes - Check the invalid route error message for the route it tried to navigate
The link buttons are generated in app/heroes/hero-detail.component.ts
like this:
<div>
<template ngFor [ngForOf]="columns" let-column>
<button routerLink="['{{column.routerLink}}']">{{column.routerLink}}</button>
</template>
</div>
..
columns: any[] = [
{
routerLink: "heroes"
},
{
routerLink: "/heroes"
},
{
routerLink: "/heroes/"
}]
Error message activatedRoute.snapshot.toString()
in app/not-found-component.ts
:
Page not found: Route(url:'hero/11/%5B'heroes'%5D', path:'**')
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Why does angular parse templates before router resolved is ...
I'm using angular and ng-route and want to handle a simple redirect if some given resolve returns false. However, if the route's template...
Read more >Resolve template validation or template format errors in ...
For "Invalid template property or properties [XXXXXXXX]" errors, see the Verify template properties section. Resolution. Note: If you receive ...
Read more >Routing in ASP.NET Core - Microsoft Learn
A route template is used to configure how the endpoint is matched. ... The LinkParser class adds support for parsing a URL path...
Read more >Routing & Navigation - ts - GUIDE - Angular
It can pass optional parameters along to the supporting view component that help it decide what specific content to present. You can bind...
Read more >matchPath - React Router v5
This lets you use the same matching code that <Route> uses except outside of the ... optional, defaults to false exact, // optional,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
and, please, read docs https://angular.io/docs/ts/latest/guide/template-syntax.html before submitting issues. thanks