Igor Simic
4 years ago

Angular - Cant bind to routerLink since it isnt a known property


If you stumble upon the error message "Can't bind to 'routerLink' since it isn't a known property" while working with Angular - here is how to solve it. This error is usually displayed when you are using [routerLink]
<a [routerLink]="['profile']">Profile</a>
the reason is that you probably did not include RouterModule to your @NgModule in imports section. Important thing is this needs to be included in every module where you are using Router link or any other router feature.
So to solve it, just include RouterModule 
@NgModule({
  declarations:[
   ...
  ],
  imports:[
    RouterModule
  ],
  exports:[
   ...
  ],
  providers: [
   ...
  ]
})