[英]Angular 2 Md Slider change event, value remains the same
I have a typescript angular 4 frontend project where i want to change the initial value of a md slider element and on change event make a web api call with that changed value. 我有一个打字稿角4前端项目,我想在其中更改md滑块元素的初始值,并在更改事件上使用更改后的值进行网络api调用。 The change event is called when i move the slider in the page but on the change event in my component the value remains what it was initially.
当我在页面中移动滑块时,将调用change事件,但是在组件中的change事件上,该值将保持最初的值。 How do I get the changed value in my component so that I can make a web api call ?
如何在组件中获取更改后的值,以便可以进行Web api调用?
You should pass $event.value
from view to component. 您应该将
$event.value
从视图传递到组件。 The $event.value
emits the new value. $event.value
发出新值。
Example: 例:
<md-slider (change)="someFucn($event.value)"></md-slider>
ts: ts:
someFucn(newVal){
alert("Slider val: " + newVal);
// Add API code here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.