Skip to content

andreialecu/angular2-moment

 
 

Repository files navigation

angular2-moment

moment.js pipes for Angular 2.0

Build Status

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.

Installation

npm install --save angular2-moment

Usage

<time>{{someDate | amTimeAgo }}</time>

Complete Example

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();
  }
}

Demo

See online demo on Plunker

About

moment.js pipes for Angular2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 68.3%
  • JavaScript 31.7%