How to fix Angular Can’t bind to ‘routerLink’ since it isn’t a known property of

If you see an error message such as

Error: src/app/my-component/my-component.component.html:2:1 - error NG8002: Can't bind to 'routerLink' since it isn't a known property of 'p-button'.
1. If 'p-button' is an Angular component and it has 'routerLink' input, then verify that it is part of this module.
2. If 'p-button' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.

in your angular app, open the module file that is declaring your component (typically app.module.ts) and add

RouterModule,

to its imports, for example:

imports: [
  CommonModule,
  RouterModule,
]