Click here to Skip to main content
15,882,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I work on angular 11 I face error when build angular app

TypeScript
ERROR in src/app/Employee-list/employee-list.component.html:22:45 - error NG8002: Can't bind to 
'routerLink' since it isn't a known property of 'a'.
<a class="nav-link text-dark">Staff List</a>

and below is package json file

TypeScript
"@angular/animations": "^11.2.14",
    "@angular/cdk": "^12.1.3",
    "@angular/common": "^11.0.0",
    "@angular/compiler": "^11.0.0",
    "@angular/core": "^11.0.0",
    "@angular/forms": "^11.0.0",
    "@angular/material": "^11.2.13",
    "@angular/router": "^11.2.14",
    "@angular/cli": "^11.0.0",
    "@angular/compiler-cli": "^11.0.0"


so How to solve issue ?

sample of app modules and component employee list exist as blow

https://stackblitz.com/edit/angular-uffug5?file=src%2Fapp%2FEmployee-list%2Femployee-list.component.ts

What I have tried:

TypeScript
<pre>on application module I do as below :

import { RouterModule } from '@angular/router';


@NgModule({
 
  imports: [
    RouterModule
Posted
Updated 30-Jul-21 5:30am
v2
Comments
Richard Deeming 2-Aug-21 5:17am    
Your <a> doesn't contain a routerLink attribute.
Angular - Add navigation with routing[^]
ahmed_sa 2-Aug-21 18:54pm    
ok thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900