L
L
lightseeker2021-08-29 18:37:20
Angular
lightseeker, 2021-08-29 18:37:20

Why is routerLink throwing an error?

header.component.html

<div class="actions-block">
    <button class="login-button" [routerlink]="'/sign-in'">Sign In</button>
</div>


And in his module (that is, header.module.ts )
@NgModule({
  declarations: [HeaderComponent],
  imports: [CommonModule, RouterModule],
  exports: [HeaderComponent, RouterModule],
})
export class HeaderModule {}


As you can see, the RouterModule is connected, but it gives an error
Can't bind to 'routerlink' since it isn't a known property of 'button'.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kiko7182, 2021-09-03
@kiko7182

[routerLink]="/sign-in".
In general, it is not clear why you have header.module.ts? Each module is a chunk that will be loaded when switching to this module. Or if you have a large separation of components. If you do not need it, then you will have 1 module - app.module.ts (here are all declarations, imports, providers, etc.) and one app-routing.module.ts (all your routes)).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question