I'm trying to import the moment.js library in angular2. I found the following solution as:
import {Component} from 'angular2/core';
import * as moment from 'moment';
@Component({
selector: 'app',
template: require('./app.component.html')
})
export class AppComponent {
moment:any = moment;
constructor() {}
}
However, I do not want to import this to every component I have. Is there a way to inject it globally so I can use it in all my components?