Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (26 sloc) 555 Bytes
import { Directive, Inject, Input, BindThis } from "../angular-decorators";
@Directive("myCurrentTime")
export class MyCurrentTime
{
@Inject() $interval;
@Inject() dateFilter;
@Inject() $element;
@Input() myCurrentTime;
timeoutId;
@BindThis() updateTime()
{
this.$element.text(this.dateFilter(new Date(), this.myCurrentTime));
}
$onInit()
{
this.timeoutId = this.$interval(this.updateTime, 1000);
}
$onDestroy()
{
this.$interval.cancel(this.timeoutId);
}
$onChanges(changes)
{
this.updateTime();
}
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.