Solved - Angular 9 introduced a global `$localize()` function that needs to be loaded
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.
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...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. 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, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Angular 10 Install Material Design Example
- Angular 10 Reactive Forms Validation Example
- Angular 9/8 Check All / Uncheck All Checkbox List Example
- How to Use Jquery Datatable in Angular?
- How to Remove A Component in Angular?
- Angular Material Checkbox Example
- How to use Bootstrap Modal in Angular?
- Angular Http Post Request Example
- Angular Get Current Route Name Example
- Angular Change Date Format in Component Example