Skip to content

Commit 4e70edb

Browse files
committed
fix(slider): apply values we received OnInit to the view
1 parent 83a8033 commit 4e70edb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/slider/slider.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
7676
[step]="step"
7777
[min]="min"
7878
[max]="max"
79-
[value]="value">
79+
[value]="value.toString()">
8080
</div>
8181
<label [id]="bottomRangeId" class="bx--slider__range-label">
8282
<ng-content select="[minLabel]"></ng-content>
@@ -179,7 +179,7 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
179179
protected eventSubscriptions: Array<Subscription> = [];
180180
protected slidAmount = 0;
181181
protected input: HTMLInputElement;
182-
protected _value = 0;
182+
protected _value = this.min;
183183
protected _disabled = false;
184184

185185
constructor(protected elementRef: ElementRef) {}
@@ -189,7 +189,10 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
189189
this.eventSubscriptions.push(fromEvent(document, "mousemove").subscribe(this.onMouseMove.bind(this)));
190190
this.eventSubscriptions.push(fromEvent(document, "mouseup").subscribe(this.onMouseUp.bind(this)));
191191

192-
// ODO: ontouchstart/ontouchmove/ontouchend
192+
// apply any values we got from before the view initialized
193+
this.value = this.value;
194+
195+
// TODO: ontouchstart/ontouchmove/ontouchend
193196

194197
// set up the optional input
195198
this.input = this.elementRef.nativeElement.querySelector("input:not([type=range])");

0 commit comments

Comments
 (0)