Basit
Basit

Reputation: 17194

Angular2-moment with Angular2-cli installation

I have installed angular2-moment into angular2-cli. While installing, angular2-cli does not have system.js, so where can I put these settings into?

https://github.com/urish/angular2-moment/#for-systemjs-users

Also I'm also getting following error:

pipe missing

Upvotes: 0

Views: 453

Answers (2)

Yoav Schniederman
Yoav Schniederman

Reputation: 5391

Just inster in angular-cli.json at script array the path to moment.

"scripts": ["../node_modules/moment/moment.js"]

Upvotes: 0

Yuri
Yuri

Reputation: 4478

Add the moment to your package.json under dependencies: "angular2-moment": "^1.0.0-beta.1". Then install it via: npm install --save.

Since you most probably use TypeScript, install Types for the moment lib: npm install @types/moment --save.

Then you need to import the MomentModule in your desired module. Eg.: import { MomentModule } from 'angular2-moment';.

And thats it, now you can use the moment pipes.

Upvotes: 4

Related Questions