我能够在Chrome和Firefox中获得预期的结果,但不能在IE 11中获得预期的结果。甚至更改范围时ngModel也没有更新。
使用以下代码,我可以在IE中获取警报,但分配给(更改)的方法不起作用。
请提出任何建议!
<input type="range"
min = "{{_minimumRangeOfSlider}}"
max="{{_maximumRangeOfSlider}}"
value="{{_currentRange}}"
(change) = "plainValueChanged($event)"
onchange="alert()"
[(ngModel)] = "_currentRange"
class="reports-range-slider">
答案 0 :(得分:3)
I got this solved by adding a change event to the range input like so:
<input type="range" [(ngModel)]="_currentRange" (change)="onChange($event.target.value)">
You have to make a onChange function in your component to assign what is passed to your value variable.
onChange(value:number):void {
this._currentRange = value;
}