Gustavo Quinteros
Gustavo Quinteros

Reputation: 153

Cannot use Ng-bootstrap in Angular 9

I started my first project in angular with ng-bootstrap and followed the installation procedure, but nevertheless It doesn't work.

The message is "Uncaught Error: It looks like your application or one of its dependencies is using i18n.

Angular 9 introduced a global $localize() function that needs to be loaded. Please add import '@angular/localize'; to your polyfills.ts file."

Then I added in polyfill.ts the line

import '@angular/localize';

and now the message changed to

ERROR in ./src/polyfills.ts Module not found: Error: Can't resolve ' @angular/localize' in 'D:\source\mh\Reclamos-v2\src'

What should I install? What is the name of localize library?

Upvotes: 9

Views: 8665

Answers (3)

Drony Qualwebs
Drony Qualwebs

Reputation: 21

This issue occurred for me even after removing the package. Removing the import statement from polyfill.ts resolves the issue for me.

Upvotes: 0

yktoo
yktoo

Reputation: 2986

You'll need to both install the package and to import it in polyfills.ts. The easiest way to achieve this is running:

ng add @angular/localize

Upvotes: 7

Raf
Raf

Reputation: 106

You can try this:

npm install @angular/localize --save

Upvotes: 9

Related Questions