Skip to content

Commit 3c6b464

Browse files
committed
fix(slider): respect ngModelOptions.updateOn: blur
1 parent be1fa8c commit 3c6b464

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

projects/igniteui-angular/src/lib/slider/slider.component.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,13 +1033,13 @@ export class IgxSliderComponent implements
10331033
this.setTickInterval();
10341034
this.changeThumbFocusableState(this.disabled);
10351035

1036-
this.subscribeTo(this.thumbFrom, this.thumbChanged.bind(this));
1037-
this.subscribeTo(this.thumbTo, this.thumbChanged.bind(this));
1036+
this.subscribeToEvents(this.thumbFrom);
1037+
this.subscribeToEvents(this.thumbTo);
10381038

10391039
this.thumbs.changes.pipe(takeUntil(this._destroyer$)).subscribe(change => {
10401040
const thumbFrom = change.find((thumb: IgxSliderThumbComponent) => thumb.type === SliderHandle.FROM);
10411041
this.positionHandler(thumbFrom, null, this.lowerValue);
1042-
this.subscribeTo(thumbFrom, this.thumbChanged.bind(this));
1042+
this.subscribeToEvents(thumbFrom);
10431043
this.changeThumbFocusableState(this.disabled);
10441044
});
10451045

@@ -1115,7 +1115,6 @@ export class IgxSliderComponent implements
11151115
// Finally do positionHandlersAndUpdateTrack the DOM
11161116
// based on data values
11171117
this.positionHandlersAndUpdateTrack();
1118-
this._onTouchedCallback();
11191118
}
11201119

11211120
/**
@@ -1412,14 +1411,18 @@ export class IgxSliderComponent implements
14121411
}
14131412
}
14141413

1415-
private subscribeTo(thumb: IgxSliderThumbComponent, callback: (a: number, b: string) => void) {
1414+
private subscribeToEvents(thumb: IgxSliderThumbComponent) {
14161415
if (!thumb) {
14171416
return;
14181417
}
14191418

14201419
thumb.thumbValueChange
14211420
.pipe(takeUntil(this.unsubscriber(thumb)))
1422-
.subscribe(value => callback(value, thumb.type));
1421+
.subscribe(value => this.thumbChanged(value, thumb.type));
1422+
1423+
thumb.thumbBlur
1424+
.pipe(takeUntil(this.unsubscriber(thumb)))
1425+
.subscribe(() => this._onTouchedCallback());
14231426
}
14241427

14251428
private unsubscriber(thumb: IgxSliderThumbComponent) {

projects/igniteui-angular/src/lib/slider/thumb/thumb-slider.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export class IgxSliderThumbComponent implements OnInit, OnDestroy {
6565
@Output()
6666
public thumbChange = new EventEmitter<any>();
6767

68+
@Output()
69+
public thumbBlur = new EventEmitter<void>();
70+
6871
@Output()
6972
public hoverChange = new EventEmitter<boolean>();
7073

@@ -188,6 +191,7 @@ export class IgxSliderThumbComponent implements OnInit, OnDestroy {
188191
this.isActive = false;
189192
this.zIndex = 0;
190193
this.focused = false;
194+
this.thumbBlur.emit();
191195
}
192196

193197
@HostListener('focus')

0 commit comments

Comments
 (0)