Search code examples
angularmomentjsangular-momentangular2-cliangular2-moment

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


Solution

  • 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.