Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将HTML滑块与Angular 2组件连接_Html_Angular_Slider_Angular2 Template - Fatal编程技术网

将HTML滑块与Angular 2组件连接

将HTML滑块与Angular 2组件连接,html,angular,slider,angular2-template,Html,Angular,Slider,Angular2 Template,我在Angular 2应用程序中使用Priming作为UI库。在某个组件中,我需要一个滑块组件。因此,我使用了相应的打底滑块组件,如下所示: <p-slider [(ngModel)]="this.adjustedCalculation.predictionYear"></p-slider> 如何通过表达式“predictionYear-10”resp.+10到那个输入元素? 让我知道我是否愿意为此提出一个新问题 谢谢 只需使用NgModel指令,与在p-slider组

我在Angular 2应用程序中使用Priming作为UI库。在某个组件中,我需要一个滑块组件。因此,我使用了相应的打底滑块组件,如下所示:

<p-slider [(ngModel)]="this.adjustedCalculation.predictionYear"></p-slider>
如何通过表达式“predictionYear-10”resp.+10到那个输入元素? 让我知道我是否愿意为此提出一个新问题


谢谢

只需使用
NgModel
指令,与在
p-slider
组件中使用指令的方式相同:

<input type="range" name="points" id="points" value="50" min="0"
max="100" data-show-value="true" data-popup-enabled="true" 
[(ngModel)]="this.adjustedCalculation.predictionYear" />
注意:我看到您在模板中使用了
这个
,没有必要这样做


这是。

谢谢,它很管用!我稍微加强了我上面的问题,要求设置输入的最小值和最大值。也许你在这里也有建议。看看我最新的答案。我还更新了我提供的Plunker。
<p-slider [(ngModel)]="this.adjustedCalculation.predictionYear" [min]="this.displayedCalculation.predictionYear - 10" [max]="this.displayedCalculation.predictionYear + 10"></p-slider>
<input type="range" name="points" id="points" value="50" min="0"
max="100" data-show-value="true" data-popup-enabled="true" 
[(ngModel)]="this.adjustedCalculation.predictionYear" />
[min]="displayedCalculation.predictionYear - 10"
[max]="displayedCalculation.predictionYear + 10"