Skip to content

Commit

Permalink
Merge pull request #8 from andreialecu/patch-2
Browse files Browse the repository at this point in the history
fix(*): wrong method name for cleanup
  • Loading branch information
urish committed Jan 13, 2016
2 parents de092ed + fce240d commit cfbfe79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions CalendarPipe.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* angular2-moment (c) 2015, 2016 Uri Shaked / MIT Licence */

import {Pipe, ChangeDetectorRef, PipeTransform, EventEmitter} from 'angular2/core';
import {Pipe, ChangeDetectorRef, PipeTransform, EventEmitter, OnDestroy} from 'angular2/core';
import * as moment_ from 'moment';

// under systemjs, moment is actually exported as the default export, so we account for that
const moment:moment.MomentStatic = (<any>moment_)['default'] || moment_;

@Pipe({name: 'amCalendar', pure: false})
export class CalendarPipe implements PipeTransform {
export class CalendarPipe implements PipeTransform, OnDestroy {

/**
* @private Internal reference counter, so we can clean up when no instances are in use
Expand Down Expand Up @@ -37,7 +37,7 @@ export class CalendarPipe implements PipeTransform {
return moment(value).calendar();
}

onDestroy():void {
ngOnDestroy():void {
if (CalendarPipe._refs > 0) {
CalendarPipe._refs--;
}
Expand Down
6 changes: 3 additions & 3 deletions TimeAgoPipe.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* angular2-moment (c) 2015, 2016 Uri Shaked / MIT Licence */

import {Pipe, ChangeDetectorRef, PipeTransform} from 'angular2/core';
import {Pipe, ChangeDetectorRef, PipeTransform, OnDestroy} from 'angular2/core';
import * as moment_ from 'moment';

// under systemjs, moment is actually exported as the default export, so we account for that
const moment:moment.MomentStatic = (<any>moment_)['default'] || moment_;

@Pipe({name: 'amTimeAgo', pure: false})
export class TimeAgoPipe implements PipeTransform {
export class TimeAgoPipe implements PipeTransform, OnDestroy {
private _currentTimer: number;

constructor(private _cdRef:ChangeDetectorRef) {
Expand All @@ -25,7 +25,7 @@ export class TimeAgoPipe implements PipeTransform {
return moment(value).from(moment());
}

onDestroy():void {
ngOnDestroy():void {
this._removeTimer();
}

Expand Down

0 comments on commit cfbfe79

Please sign in to comment.