Skip to content

Commit 9ef228b

Browse files
authored
Merge pull request #548 from cal-smith/issue#545
fix(slider): apply values we received OnInit to the view
2 parents d83f0de + 55dcde1 commit 9ef228b

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
@@ -79,7 +79,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
7979
[step]="step"
8080
[min]="min"
8181
[max]="max"
82-
[value]="value">
82+
[value]="value.toString()">
8383
</div>
8484
<label [id]="topRangeId" class="bx--slider__range-label">
8585
<ng-content select="[maxLabel]"></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)