Ngx-Bootstrap and Angular 9 ModuleWithProviders Error

Viewed 4656

I get the error below

ERROR in node_modules/ngx-bootstrap/popover/popover.module.d.ts:3:23 - error NG6005: 
PopoverModule.forRoot returns a ModuleWithProviders type without a generic type argument. 
Please add a generic type argument to the ModuleWithProviders type.
If this occurrence is in library code you don't control, please contact the library authors.

I just added Ngx-Bootstrap's Popover Module and imported PopoverModule.forRoot(). This seems to be Angular 9 incompatibility. How to solve this?

4 Answers

It's so petty how I solved this error.

I simply run ng add ngx-bootstrap --component popover.

It says:

Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'popover'

But when I served the project, it ran successfully anyway.

you need add the following script into your package.json

{
  "scripts": {
    "postinstall": "ngcc"
  }
}

and then run npm i

see description here

This issue should be fixed in latest version, which correctly works with Angular 9 - in 6.0.0.
Also, it supports Angular 10.

Noe: This can also be resolved by specifying complete path

import { PopoverModule } from 'ngx-bootstrap/popover'; 
Related