This error is quite common in Angular.
To perform navigation with Angular, we use the routerLink directive on a HTML element usually the <a>
tag.
Let’s consider a NavigationBarComponent with a template like this.
<a [routerLink]="['/home']">
Home
</a>
Indeed the routerLink directive has to be imported in our component’s module otherwise we get this error: can’t bind to ‘routerlink’ since it isn’t a known property of ‘a’
In other words the module that is declaring our component must import the RouterModule.
import {RouterModule} from '@angular/router';
@NgModule({
declarations: [NavigationBarComponent]
imports: [RouterModule]
})
export class NavigationBarModule {}