3

I have created a form that has inputs of text type and a mat-slider to get a numeric value

// TS
this.consumptionForm = this.formBuilder.group({
      dailyConsumption: ['', Validators.required],
      cost: [20, Validators.required],
    });

// HTML
<form #form="ngForm" [formGroup]="consumptionForm" novalidate>
     <label>Cost</label>
     <mat-slider formControlName="cost" [min]="10" [max]="1000" >
                </mat-slider>


   <div>
           <mat-form-field [floatLabel]="true">
              <mat-label>Daily Consumption</mat-label>
               <input matInput formControlName="dailyConsumption"/>
           </mat-form-field>
        </div>
 </form>

I want the mat-slider to work in conjunction with the rest of the form, and if it is not possible to know which approach is used to use it.

I see that the formControlName is not working

juanjinario
  • 596
  • 1
  • 9
  • 24

0 Answers0