Skip to content

Commit

Permalink
Merge pull request #1 from alex030293/master
Browse files Browse the repository at this point in the history
Add duration config
  • Loading branch information
jmandreslopez authored Jun 15, 2017
2 parents 64773bd + a48a563 commit 54e4d56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/odometer/odometer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
});
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions src/odometer/odometer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface Ng2OdometerConfigModel {
format?: string;
theme?: string;
value?: number;
duration?: number;
auto?: boolean;
}

Expand All @@ -18,5 +19,6 @@ export class Ng2OdometerConfig implements Ng2OdometerConfigModel {
format: string = '(,ddd)';
theme?: string = 'default';
value?: number = 0;
duration?: number = 2000;
auto?: boolean = true;
}

0 comments on commit 54e4d56

Please sign in to comment.