diff --git a/src/odometer/odometer.component.ts b/src/odometer/odometer.component.ts index bcf2cea..1cc9637 100644 --- a/src/odometer/odometer.component.ts +++ b/src/odometer/odometer.component.ts @@ -61,6 +61,7 @@ export class Ng2OdometerComponent implements OnInit, OnDestroy, OnChanges, After @Input() format: string = undefined; @Input() theme: string = undefined; @Input() value: number = undefined; + @Input() duration: number = undefined; private subscription: Subscription; private odometer: OdometerModel; @@ -84,6 +85,7 @@ export class Ng2OdometerComponent implements OnInit, OnDestroy, OnChanges, After el: this.container.nativeElement, animation: this.config.animation, value: this.config.value, + duration: this.config.duration, format: this.config.format, theme: this.config.theme, }); @@ -117,6 +119,11 @@ export class Ng2OdometerComponent implements OnInit, OnDestroy, OnChanges, After this.config.value = this.value; } + // Duration + if (!_.isUndefined(this.duration)) { + this.config.duration = this.duration; + } + // Validate theme. If not part of the // available themes array, use the default if (!_.includes(this.themes, this.config.theme)) { diff --git a/src/odometer/odometer.config.ts b/src/odometer/odometer.config.ts index 06c9766..99e0654 100644 --- a/src/odometer/odometer.config.ts +++ b/src/odometer/odometer.config.ts @@ -10,6 +10,7 @@ export interface Ng2OdometerConfigModel { format?: string; theme?: string; value?: number; + duration?: number; auto?: boolean; } @@ -18,5 +19,6 @@ export class Ng2OdometerConfig implements Ng2OdometerConfigModel { format: string = '(,ddd)'; theme?: string = 'default'; value?: number = 0; + duration?: number = 2000; auto?: boolean = true; }