Angular 9 Introduced A Global '$localize()' Function That Needs To Be Loaded


Answer :

You need to make sure you have the @angular/localize package first:

npm install @angular/localize --save

Then, import '@angular/localize/init' in your polyfills.ts file just like the error says


The best way if you are using Angular CLI is to run

ng add @angular/localize

It will take care of it automatically

Or else

import '@angular/localize/init'; to your polyfills.ts

Tested with Angular 9


If you have many angular projects in same workspace, running ng add @angular/localize will add import statement import '@angular/localize/init' to polyfills.ts in default Project only,i think this will be fixed in later updates.

so you need to add import '@angular/localize/init' manually to polyfills.ts in other projects.


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable