Angular material slider change event doesn't work

Viewed 775

I am using angular2 md-slider in a component and I have a problem with the change event:

  • first I change the value using the slider for example to 20.
  • next I change the value to 19 using a button and function in controller
  • and again I change the value to 20 using slider. But it doesn't fire the change event.
1 Answers

You can emit the value yourself.

When you change the slider via a method, also emit the change:

this.slider.value = 10;
this.slider.change.emit({ source: this.slider, value: this.slider.value });

I believe they fixed this, but this helps if you want the event emitted when the value is changed via a method as well.

Related