Simple Trick To Make Your Angular Routes (Semi) Typed

Touhid Rahman
JavaScript in Plain English
3 min readMay 2, 2024

--

I have seen so many projects where [routerLink] directive on link or button elements gets the input in hard coded value. For example:

<a [routerLink]="['/movies', movie.id, 'edit']"> Edit Movie </a> 

If someday you want to change the movie to film or edit to update , this might break the link unless you go and update every occurance in the…

--

--