Skip to content

Commit 032c4bc

Browse files
committed
fix(slider): respect ngModelOptions.updateOn: blur
1 parent a0dddd4 commit 032c4bc

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
@@ -991,13 +991,13 @@ export class IgxSliderComponent implements
991991
this.setTickInterval();
992992
this.changeThumbFocusableState(this.disabled);
993993

994-
this.subscribeTo(this.thumbFrom, this.thumbChanged.bind(this));
995-
this.subscribeTo(this.thumbTo, this.thumbChanged.bind(this));
994+
this.subscribeToEvents(this.thumbFrom);
995+
this.subscribeToEvents(this.thumbTo);
996996

997997
this.thumbs.changes.pipe(takeUntil(this._destroyer$)).subscribe(change => {
998998
const thumbFrom = change.find((thumb: IgxSliderThumbComponent) => thumb.type === SliderHandle.FROM);
999999
this.positionHandler(thumbFrom, null, this.lowerValue);
1000-
this.subscribeTo(thumbFrom, this.thumbChanged.bind(this));
1000+
this.subscribeToEvents(thumbFrom);
10011001
this.changeThumbFocusableState(this.disabled);
10021002
});
10031003

@@ -1078,7 +1078,6 @@ export class IgxSliderComponent implements
10781078
// Finally do positionHandlersAndUpdateTrack the DOM
10791079
// based on data values
10801080
this.positionHandlersAndUpdateTrack();
1081-
this._onTouchedCallback();
10821081
}
10831082

10841083
/**
@@ -1411,14 +1410,18 @@ export class IgxSliderComponent implements
14111410
}
14121411
}
14131412

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

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

14241427
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
@@ -66,6 +66,9 @@ export class IgxSliderThumbComponent implements OnInit, OnDestroy {
6666
@Output()
6767
public thumbChange = new EventEmitter<any>();
6868

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

@@ -189,6 +192,7 @@ export class IgxSliderThumbComponent implements OnInit, OnDestroy {
189192
this.isActive = false;
190193
this.zIndex = 0;
191194
this.focused = false;
195+
this.thumbBlur.emit();
192196
}
193197

194198
@HostListener('focus')

0 commit comments

Comments
 (0)