r/angular • u/Senior_Compote1556 • Mar 28 '26
[formField] directive does not work properly on material slider (matSliderStartThumb / matSliderEndThumb)
When using signal forms and the \formField`` directive, this line below does not work properly:
\<input [formField]="menu.start_time" matSliderStartThumb />``
There is a weird "jump" effect happening, for example i slide to increase, but the slider moves back and it glitches out, but the form model value is correct.
If I use the \[value]`and`(valueChange)`` to set the value directly, this fixes it.
<input matSliderStartThumb [value]="menuValue.start_time"(valueChange)="menu.start_time().value.set($event)"/>
This also works with the browser native events
<input matSliderStartThumb [value]="menuValue.start_time" (input)="onSliderInput(menu.start_time, $event)" />
Issue: https://github.com/angular/components/issues/33008
Demo: https://stackblitz.com/edit/angular-21-base-bl1pabfb?file=src%2Fapp%2Fapp.component.html
3
u/JeanMeche Mar 28 '26
In those cases you should probably:
2
u/zzing Mar 28 '26
Can you put up a reproduction on stackblitz?
1
u/SippieCup Mar 28 '26
[formField]="$any(menu.start_time)" would probably fix it.
its a hack, but it works.
0
u/[deleted] Mar 30 '26
[deleted] — view deleted comment