Can't bind to 'routerLink' since it isn't a known property of 'a'.ngtsc(-998002). How I fixed?



You need to import the routing module with this component to the root module of the feature.


The ngtsc error 998002

For example, you have faced this error in the NewOrderComponent and this component is accessible by some route. We have the following routing module:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NewOrderComponent } from './new-order/new-order.component';

const routes: Routes = [
  { path: '', component: NewOrderComponent },

  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
export class FeatureRoutingModule { }

To fix this error you need to include the FeatureRoutingModule to the imports array in the @NgModule of FeatureNewModule:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NewOrderComponent } from './new-order/new-order.component';
import { NzTabsModule } from 'ng-zorro-antd/tabs';
import { FeatureNewOrderModuleRoutingModule } from './feature-new-routing.module';
  imports: [CommonModule, NzTabsModule, FeatureRoutingModule],
  declarations: [
export class FeatureNewModule {}

By the way, this is the solution for Can't bind to 'routerLink' since it isn't a known property of 'a'.ngtsc(-998002).

comments powered by Disqus