Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Entrada del formateador Nz-Slider, nz-zorro-9.3.1

algo extraño está mal con el control deslizante. Quiero cambiar el valor del control deslizante por otro valor que estaría en el componente donde se encuentra el control deslizante. Cuando uso el formateador de entrada, todo está bien, pero cuando uso el "this.slider" me devuelve indefinido. ya que la función del formateador al pasarla por entrada pierde su contexto. dejo un ejemplo para mayor claridad

 export class ConfigurationRulesListComponent implements OnInit { @ViewChild('slider', { static: false }) sliderComponent: NzSliderComponent; listOfValues: Array<string> = []; currentValue = 0; minValue = 0; maxValue = 0; stepMarks: Marks = {}; constructor() {} ngOnInit() { this.getValuesFromBackend(); this.init(); } formatter(index: number): string { const marksFound: Marks = this.sliderComponent.nzMarks; // here undefine beccose, is other context const label = (marksFound[index] as MarkObj).label; const result = new RegExp(/(?<=<strong>\s*).*?(?=\s*<\/strong>)/); const matchResults = label.match(result); return `${matchResults[0]}`; } private init() { // para construir las marcas en caso de que tengan estilos determinados for (let i = 0; i < this.listOfValues.length; i++) { const newMark = new Marks(); newMark[i] = { style: { color: '#f50' }, label: `<strong>${this.listOfValues[i]}</strong>` }; this.stepMarks = { ...this.stepMarks, ...newMark }; } } private getValuesFromBackend() { // adicionarle observables this.listOfValues = ['First', 'Second', 'Third', 'fourth', 'fifth', 'sixth']; this.currentValue = 0; this.minValue = 0; this.maxValue = this.listOfValues.length - 1; } }

html>

 <nz-slider #slider [nzMin]="minValue" [nzMax]="maxValue" [nzMarks]="stepMarks" [(ngModel)]="currentValue" [nzTipFormatter]="formatter" ></nz-slider>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!