ng2-nouislider icon indicating copy to clipboard operation
ng2-nouislider copied to clipboard

Component does not work with formControlName attribute

Open yuliankarapetkov opened this issue 5 years ago • 3 comments

TypeScript:

form = this._formBuilder.group({
        range: [[0, 20]]
    });

Using [formControl] works fine:

<form [formGroup]="form">
    <nouislider [connect]="true" [min]="0" [max]="10" [step]="1" [formControl]="form.control.range"> 
    </nouislider>
</form>

But formControlName doesn't work:

<form [formGroup]="form">
    <nouislider [connect]="true" [min]="0" [max]="10" [step]="1" formControlName="range"> 
    </nouislider>
</form>

And causes the following exception:

ERROR Error: noUiSlider (14.0.3): 'start' is required.

yuliankarapetkov avatar Oct 16 '19 08:10 yuliankarapetkov

For me it is not working with formControl nor with formControlName. Any update on this ticket?

asadmalik3 avatar Nov 30 '19 13:11 asadmalik3

@yuliankarapetkov me too same error

riazXrazor avatar Apr 27 '20 07:04 riazXrazor

You have to specify start property in config like specified in error. My Example: <nouislider #slider [config]="sliderConfig" formControlName="myControlName" [(ngModel)]="rangeValues" (ngModelChange)="onChange($event)"></nouislider>

rangeValues:any = [];
sliderConfig: any = {
    orientation: "vertical",
    direction: "rtl",
    start: [1000, 4000],
    behaviour: 'drag',
    connect: true,
    keyboard: true,
    step: 50,
    pageSteps: 10,
    range: {
      min: 0,
      max: 5000
    },
    pips: {
      mode: 'count',
      density: 2,
      values: 6,
      stepped: true
    },
    tooltips: [true, true]
  };

anton-nikitsiuk avatar Jan 25 '21 17:01 anton-nikitsiuk