core.js:4002 ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[Table -> FilterService]:

  angular, primeng, typescript

I am trying to use PrimeNg Table control in my application – a beginner in PrimeNg & Angular as well
and am getting an error No provider for FilterService! as below

core.js:4002 ERROR Error: Uncaught (in promise): NullInjectorError:
StaticInjectorError(AppModule)[Table -> FilterService]:
StaticInjectorError(Platform: core)[Table -> FilterService]:
NullInjectorError: No provider for FilterService! NullInjectorError: StaticInjectorError(AppModule)[Table ->
FilterService]: StaticInjectorError(Platform: core)[Table ->
FilterService]:
NullInjectorError: No provider for FilterService!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get
(core.js:725)
at resolveToken (core.js:11918)
at tryResolveToken (core.js:11862)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get
(core.js:11764)
at resolveToken (core.js:11918)
at tryResolveToken (core.js:11862)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get
(core.js:11764)
at resolveNgModuleDep (core.js:20234)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get
(core.js:20905)
at resolveDep (core.js:21276)
at resolvePromise (zone.js:852)
at resolvePromise (zone.js:809)
at zone.js:913
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask
(zone.js:423)
at Object.onInvokeTask (core.js:26247)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask
(zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask
[as invoke] (zone.js:502)
at invokeTask (zone.js:1693)

What I have done

  1. I have installed PrimeNg as given in the PrimeNg Getting Started set up .
  2. After that I have added the below in app.module.ts

import { ButtonModule } from ‘primeng/button’;

import { TableModule } from 'primeng/table';

imports:[
 ...
 ButtonModule,
    TableModule]
  1. If I use Button I am not getting any issue <button pButton type="button" label="Click" ></button>
  2. But if I place p-table I am getting the above mentioned error.

(pTable like ==> <p-table [value]="cars"> …..

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.