英文:
Mat Slider Value in Angular 15
问题
代码在Angular 14中运行正常,但在Angular 15中不起作用。
<mat-slider
min="1"
max="150"
step="10"
value="55"
#itemHeight
>
</mat-slider>
<label> {{ itemHeight.value }} hie </label>
StackBlitz链接 => https://stackblitz.com/edit/angular-ixbgdr?file=src%2Fmain.ts
英文:
The code used to work in Angular 14 but is not working in Angular 15.
<mat-slider
min="1"
max="150"
step="10"
value="55"
#itemHeight
>
</mat-slider>
<label> {{ itemHeight.value }} hie </label>
StackBlitz link => https://stackblitz.com/edit/angular-ixbgdr?file=src%2Fmain.ts
答案1
得分: 2
你现在必须将输入传递给滑块:
<mat-slider min="1" max="5" step="0.5" value="1.5">
<input matSliderThumb #itemHeight>
</mat-slider>
<label>{{itemHeight.value}}</label>
英文:
You now have to pass an input to the slider :
<mat-slider min="1" max="5" step="0.5" value="1.5">
<input matSliderThumb #itemHeight>
</mat-slider>
<label> {{itemHeight.value}} </label>
答案2
得分: 0
MDC迁移指南清晰地概述了任何更改。
您也可以从滑块组件的文档中找到您的答案 - Material 文档。
英文:
Any changes are clearly outlined in the MDC migration guide - MDC Migration Guide
You would have found your answer also from the docs for the slider component - Material Docs
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论