Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 250
Gustavo Quinteros Avatar asked Sep 16 '19 22:09

Gustavo Quinteros


2 Answers

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
like image 130
yktoo Avatar answered Oct 23 '22 21:10

yktoo


You can try this:

npm install @angular/localize --save
like image 33
Raf Avatar answered Oct 23 '22 20:10

Raf