angularprimengangular16

What is the meaning of - 1. If '<tag>' is an angular component, then verify that it is part of this module


What is the meaning of the error and how to fix it

  1. If '<tag>' is an Angular component, then verify that it is part of this module.
  2. If '<tag>' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA'

Error Message is :

Error: src/app/app.component.html:29:4 - error NG8001: 'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

29    <router-outlet></router-outlet>
      ~~~~~~~~~~~~~~~

  src/app/app.component.ts:7:16
    7   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.


Error: src/app/app.component.html:31:4 - error NG8001: 'progress-bar' is not a known element:
1. If 'progress-bar' is an Angular component, then verify that it is part of this module.
2. If 'progress-bar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

31    <progress-bar *ngIf="showLoader"></progress-bar>
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  src/app/app.component.ts:7:16
    7   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.


Error: src/app/app.module.ts:26:5 - error NG6001: Cannot declare 'TableModule' in an NgModule as it's not a part of the current compilation.

26     TableModule,
       ~~~~~~~~~~~

  node_modules/primeng/table/table.d.ts:1397:22
    1397 export declare class TableModule {
                              ~~~~~~~~~~~
    'TableModule' is declared here.

app.module.ts - Here I tried

  1. adding the schema but no luck.
  2. I have imported all the necessary packages
  3. Imported formsmodule and reactiveformsmodule but no luck
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ProgressBarComponent } from './_helpers/progress-bar/progress-bar.component';
import { CitationDashboardComponent } from './modules/citation-dashboard/citation-dashboard.component';
import { TableFilterPipe } from './pipes/tabular-filter.pipe';
import { GenericHttpService } from 'src/app/config/GenericHttp/generic-http.service'
import { NgSelectModule } from "@ng-select/ng-select";
import { HttpClientModule } from '@angular/common/http';
import { TableModule } from 'primeng/table'; 
import { httpInterceptProviders } from './http-interceptors/auth-index';
import { HomePageComponent } from './modules/home-page/home-page.component';


// import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// import { NO_ERRORS_SCHEMA,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@NgModule({
  declarations: [
    AppComponent,
    ProgressBarComponent,
    TableFilterPipe,
    TableModule,
    CitationDashboardComponent,
    HomePageComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    CommonModule,
    NgSelectModule,
    HttpClientModule,
    AppRoutingModule
  ],
  // schemas: [
  //   CUSTOM_ELEMENTS_SCHEMA,
  //   NO_ERRORS_SCHEMA
  // ],
  providers: [GenericHttpService, httpInterceptProviders],
  bootstrap: [AppComponent]
})
export class AppModule { }

I started facing this issue after installing primeng. Now I uninstalled primeng but the issue still persists. Attaching package.json for package version details

{
  "name": "ermapplications",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.0.0",
    "@angular/common": "^16.0.0",
    "@angular/compiler": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/forms": "^16.0.0",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0",
    "@angular/router": "^16.0.0",
    "@ng-bootstrap/ng-bootstrap": "^15.0.0",
    "@ng-select/ng-option-highlight": "^11.1.1",
    "@ng-select/ng-select": "^11.0.0",
    "@types/file-saver": "^2.0.7",
    "bootstrap": "^5.2.0",
    "fontawesome": "^5.6.3",
    "hammerjs": "^2.0.8",
    "jquery": "^3.6.1",
    "polyfills": "^2.1.1",
    "popper.js": "^1.16.1",
    "primeicons": "^7.0.0",
    "primeng": "^16.9.1",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.0",
    "@angular/cli": "~16.0.0",
    "@angular/compiler-cli": "^16.0.0",
    "@types/jasmine": "~4.3.0",
    "@types/jquery": "^3.5.14",
    "@types/node": "^12.11.1",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "rxjs": "^6.5.3",
    "typescript": "^4.9.3",
    "webpack-dev-server": "^4.15.1"
  },
  "description": "This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.0.",
  "main": "index.js",
  "keywords": [],
  "author": "",
  "license": "ISC"
}


Solution

  • Modules (TableModule) belongs in the imports array, maybe this is causing the list of errors to appear!

    @NgModule({
      declarations: [
        AppComponent,
        ProgressBarComponent,
        TableFilterPipe,
        // TableModule, // <- remove this.
        CitationDashboardComponent,
        HomePageComponent
      ],
      imports: [
        TableModule, // <- add here
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        CommonModule,
        NgSelectModule,
        HttpClientModule,
        AppRoutingModule
      ],
      // schemas: [
      //   CUSTOM_ELEMENTS_SCHEMA,
      //   NO_ERRORS_SCHEMA
      // ],
      providers: [GenericHttpService, httpInterceptProviders],
      bootstrap: [AppComponent]
    })
    export class AppModule { }