简体   繁体   中英

Angular material slider change event doesn't work

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM