How to use moment.js library in angular 2 typescript app? -
i tried use typescript bindings:
npm install moment --save typings install moment --ambient -- save
test.ts:
import {moment} 'moment/moment';
and without:
npm install moment --save
test.ts:
var moment = require('moment/moment');
but when call moment.format(), error. should simple, can provide command line/import combination work?
we're using modules now, try import {momentmodule} 'angular2-moment/module';
after npm install angular2-moment.. http://ngmodules.org/modules/angular2-moment
Comments
Post a Comment