moment.js pipes for Angular 2.0
This module works with the latest beta release of Angular 2.0.
For the stable AngularJS 1.x version of this module, please see angular-moment.
npm install --save angular2-moment
<time>{{someDate | amTimeAgo }}</time>
import {Component} from 'angular2/core';
import {TimeAgoPipe} from 'angular2-moment';
@Component({
selector: 'app',
pipes: [TimeAgoPipe],
template: `
Last updated: <b>{{myDate | amTimeAgo}}</b>
`
})
export class App {
myDate: Date;
constructor() {
this.myDate = new Date();
}
}