Solved - Angular 9 introduced a global `$localize()` function that needs to be loaded

By Hardik Savani | August 21, 2020 | Category : Angular

When i was working on my angular 10 project, i simply installed @ng-bootstrap/ng-bootstrap and add model on it. then i run app i got error "Angular 9 introduced a global `$localize()` function that needs to be loaded".

You can also see bellow error that was getting on my browser console. project run successfully, but i was getting error. you can see bellow full error:

core.js:31451 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 run `ng add @angular/localize` from the Angular CLI.

(For non-CLI projects, add `import '@angular/localize/init';` to your `polyfills.ts` file.

For server-side rendering applications add the import to your `main.server.ts` file.)

at push../node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js._global.$localize (core.js:31451)

at Module../node_modules/@ng-bootstrap/ng-bootstrap/__ivy_ngcc__/fesm2015/ng-bootstrap.js (ng-bootstrap.js:69)

at __webpack_require__ (bootstrap:79)

at Module../src/app/app.component.ts (app.component.ts:1)

at __webpack_require__ (bootstrap:79)

at Module../src/app/app.module.ts (app.module.ts:1)

at __webpack_require__ (bootstrap:79)

at Module../src/main.ts (main.ts:1)

at __webpack_require__ (bootstrap:79)

After long research i found solution how to do it and we need to install @angular/localize and import it. so let's see solution.


Install @angular/localize

npm install @angular/localize --save

Import in src/polyfills.ts file

import '@angular/localize/init'

Now you can see it will works.

I hope it can help you...

Tags : Angular

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: