Search code examples
angular2-routing

Angular 2 routerLink is not clickable


I am trying to use routerlinl, but somehow it is not clickable. Please can someone help. Following are the codes:

**app.module.ts:**

import { RouterModule } from '@angular/router';
.....
@NgModule({....})
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot([
  { path: 'employees', component: EmployeesComponent },
  { path: 'login', component: LoginComponent },
  { path: 'index', component: IndexComponent },
  { path: '**', component: PageNotFoundComponent },
  { path: '', pathMatch: 'full', redirectTo: '/index' }

])
],


**app.component.html:**

<h1>App (root) component</h1>
<ul class="nav nav-tabs">
<li>
    <a routerlink="/login" routerLinkAction="active">Login</a>
</li>
</ul>
<router-outlet></router-outlet>


**app.component.ts:**
import { RouterModule, Routes } from '@angular/router';
....

(The .... means there are codes but not putting here due to relevance).


Solution

  • Change routerlink to routerLink

    like

    routerLink="/login"
    

    not

    routerlink="/login"
    

    Care about letter casing as selectors are case sensitive.