igx-slider - can't reflect Reactive form's value when dynamically changing maxValue.
Description
This is related to #920.
As a workaround for #920, I'm binding upperBound as well as maxValue.
Then, another issue came up. igx-slider can't bind Reactive form's value.
Steps to reproduce
- Go to https://stackblitz.com/edit/igx-slider-issue2.
- Click "Set Value: 50" button.
Result
The upper igx-slider works well. But the lower one can't reflect Reactive form's value.
Expected result
igx-slider should reflect Reactive form's value.
By the way, here is a scenario what I want to achieve with igx-slider.
- There is a
igx-grid. - Click a cell, then, open
igx-dialogand pass the cell(or row) data to the dialog. - The dialog has a form including
igx-slider. - The data is bound to the form via
ReactiveForm. - That's why igx-slider's
maxValuevaries according to the passed data.
This behavior is not really a bug. In the sample you have provided, in the button click event handler you are updating both, the model property to which slider's upperBound input is bound and the form control value, i.e our slider's value. The problem comes from the fact that upperBound input is updated after the value input while the internal implementation of the value input depends on that upperBound. Therefore the value input is not set correctly. To solve this problem, I would suggest wrapping the patchValue method in a timeout:
setValue() {
this.maxValue = 100;
setTimeout(() => {
this.form.patchValue({
value1: 50,
value2: 50
});
});
}
....or just using separate buttons for updating the the data and the form models.