PrimeNG - How to control slider for range

Discussão em 'Angular' iniciado por Sergio, Janeiro 6, 2025.

  1. Sergio

    Sergio Guest

    I want to modify the values of a PrimeNG slider through two inputs. When the slider is not a range, it works fine, and I can control the slider from the input. However, when it comes to a range slider, it stops working, and I'm unable to control it from the inputs.

    //Case 1: Input control works
    <input type="text" pInputText [(ngModel)]="value"/>
    <p-slider [(ngModel)]="value"></p-slider>


    //Case 2: Inputs controls don't work
    <input type="text" pInputText [(ngModel)]="values[0]" />
    <p-slider [(ngModel)]="values" [range]="true"></p-slider>
    <input type="text" pInputText [(ngModel)]="values[1]" />


    If this doesn't work, how can I control a range slider from an input?

    https://stackblitz.com/edit/primeng-slider-bug

    Continue reading...

Compartilhe esta Página