Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng5-slider high value sets in wrong position

Tags:

angular

slider

I'm using ng5-sliders in mat-menu but the high value of each slider sets in wrong position, not on the edge of slider.

I tried some solutions eg. manual refresh but it doesn't work

There is example on stackblitz

like image 507
drigue Avatar asked Feb 27 '26 19:02

drigue


1 Answers

I was facing same issue. Just increase your timeout to 200 & it resolved.

import { Component, OnInit, EventEmitter } from '@angular/core';
import { Options } from 'ng5-slider';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent implements OnInit {
  displayMenu = true;
filterElement = [
      {
        value: 0,
        highValue: 15,
        options: {
          floor: 0,
          ceil: 15,
          step: 0.1
        },
      },
      {
        value: 1,
        highValue: 1200,
        options: {
          floor: 1,
          ceil: 1200,
        },
      }];
  manualRefresh: EventEmitter<void> = new EventEmitter<void>();

  ngOnInit() {
  }
  noClickable($event: MouseEvent) {
    $event.stopPropagation();
  }
  onMenuOpen() {
      this.displayMenu = true;
  }
  menuToggle(value: boolean) {

    setTimeout(() => {
        console.log('Test');
        this.manualRefresh.emit();
    }, 200);

  }
}

Here is the resource link where I have just change the timeout from 100 to 200

https://stackblitz.com/edit/angular-8c46ta

like image 183
neha gupta Avatar answered Mar 01 '26 13:03

neha gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!