Hi,
I'm not much familiar with it but yes I can help you to get out of this.
You can cancel the slider event by using the
method on the
object passed to the
event handler. This method will prevent the default behavior of the event, which in this case is updating the value of the slider.
You can follow this example on how you can use this method to cancel the slider event:
Code: Select all
handleSliderMagnificationChange(event) {
if (cancelEvent) {
event.preventDefault();
}
}
However, it is important to note that in this example
object is undefined.
The
in your code refers to the
object, which is the current value of the slider.
You can pass the value as a parameter and check if the condition met and then prevent the event.
Code: Select all
handleSliderMagnificationChange(value: number) {
if (value === some_value) {
return;
}
}
You can also make use of the
event instead of
which will trigger when the user releases the slider, allowing you to check the value and prevent the event if necessary.
Code: Select all
<p-slider [(ngModel)]="overlayMagnificationPercentage" [min]="minMagnification" [max]="maxMagnification" [step]="magnificationInterval" (onSlideEnd)="handleSliderMagnificationChange($event)"></p-slider>
Also, you can check the PrimeNG documentation or community forum for more information on how to handle the slider events.
Thanks