2

How do I load the Globalize library along with the CLDR data in an Angular app generated from angular cli. When I perform the following steps:

  1. npm install globalize cldr-data
  2. import {Globalize} from 'globalize'; in app.component.ts
  3. ng serve

I get this error:

Can't resolve 'cldr' in '/Users/temp-user/cldr-app/node_modules/globalize/dist'
 @ ./~/globalize/dist/globalize.js 22:2-25:14
 @ ./~/globalize/dist/node-main.js
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

EDIT:

Also tried including it in scripts in angular-cli.json

  "scripts": [
     "../node_modules/cldrjs/dist/cldr.js",
     "../node_modules/globalize/dist/globalize.js"
  ],
takeradi
  • 3,661
  • 7
  • 29
  • 53

1 Answers1

0

just including any library wont suffice to use it, you need to configure it in angular-cli.json file.

"scripts": [
  ... path to global libraray
]

Read more about Global Library Installation here.

Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69