How to fix Angular standalone component: Can't bind to 'routerLink' since it isn't a known property of 'a'

Problem:

When opening your Angular app with a standalone component, you see the following error message:

Solution

In the component where the error occurs, add

and add

to the imports of the component. Example:

 


Check out similar posts by category: Angular, Typescript