I installed moment.js using npm install moment --save, and now it is in my node_modules folder, but I don't know how to reference it in my application.
Q) How can I use moment.js in my Ionic 2 application when I installed it using npm?
Here's a shortened version of my app.ts:
import {App, IonicApp, Platform, Modal, Events, Alert, MenuController} from 'ionic-angular';
import {Type} from 'angular2/core';
import {OnInit, OnDestroy} from 'angular2/core';
import {Keyboard} from 'ionic-native';
@App({
templateUrl: 'build/app.html',
config: {},
providers: []
})
class MyApp {
isLoadingData: boolean = false;
rootPageToExitOn: string;
rootPage: Type;
pages: Array<{icon: string, title: string, component: Type}>;
showMenu: boolean;
constructor(
private app: IonicApp,
private platform: Platform,
private menu: MenuController,
private _events: Events
) {
this.initializeApp();
}
}
source
share