Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parentheses break Angular routing on page refresh

I am able to get to the following path from within the angular application (by clicking on the product link that has a routerLink):

{basePath}/product/trek-monda-slr-frameset-(h2-fit)-2016

However, once I refresh the page angular throws an error in the console and will not serve up the page:

Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'h2-fit'

My guess is that the angular router doesn't allow parentheses. But aren't parentheses valid characters in urls for most browsers?

Why isn't Angular allowing this?

like image 274
Kevin LeStarge Avatar asked Feb 16 '17 19:02

Kevin LeStarge


1 Answers

I know this isn't the most helpful, but it looks like there is an open bug on Angular's github that relates to this issue:

https://github.com/angular/angular/issues/10280

If you have those parenthese hard coded then you could do like this comment says and replace them. https://github.com/angular/angular/issues/10280#issuecomment-279784004

like image 107
Stout01 Avatar answered Nov 15 '22 05:11

Stout01