Open somada141 opened 6 years ago
@somada141 Hi, do you have any updates?
@venoby no nothing but I've benched it for the time being and will revisit at some point.
for the second slider you can use:
<nouislider
class="form-control"
id="years"
name="years"
[connect]="true"
[min]="0"
[max]="15"
[step]="1"
[(ngModel)]="someRange"
formControlName="range"
></nouislider>
</div>
you can use ngModel and formControlName in the same element inside an Reactive Form
ngModel + formControlName helps, but soon will be removed:
It looks like you're using ngModel on the same form field as formControlName. Support for using the ngModel input property and ngModelChange event with reactive form directives has been deprecated in Angular v6 and will be removed in Angular v7.
For more information on this, see our API docs here:
https://angular.io/api/forms/FormControlName#use-with-ngmodel
Hi there,
I've set up a little example showcasing my issue under https://stackblitz.com/edit/angular-6hoyua (sorta like JSFiddle). The above can be edited.
What I'm trying to figure out is how to use the slider in the reactive approach while connecting it to the
FormControl
via theformControlName
as opposed to[formControl]
.Here's the code:
app.module.ts:
app.component.ts:
app.component.html:
The result for which is:
As you can see the 1st and 3rd instance is working fine but the 2nd won't show. Now I saw some issues detailing similar problems but I couldn't figure out a solution to this. Is the 2nd approach not supported for some reason?