Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component does not work with formControlName attribute #220

Open
yuliankarapetkov opened this issue Oct 16, 2019 · 3 comments
Open

Component does not work with formControlName attribute #220

yuliankarapetkov opened this issue Oct 16, 2019 · 3 comments

Comments

@yuliankarapetkov
Copy link

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.
@asadmalik3
Copy link

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

@riazXrazor
Copy link

@yuliankarapetkov me too same error

@anton-nikitsiuk
Copy link

anton-nikitsiuk commented Jan 25, 2021

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]
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants