Closed SigmaOutdoors closed 5 years ago
I think this might be because I commented out the [(ngModel)]="property.value" in the checkbox HTML because I was getting this error, sorry for bugging you.
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
Putting the ngModel back in fixed the issue, but that warning is not good, I have zero idea what they're saying in that link to try and do it correctly for v7
https://angular.io/api/forms/FormControlName#use-with-ngmodel
So Here's what seems to be working in dynamic-form.component.html/ts I took out the ngModel and created checkChanged which does the form setting as per the garble on that web page.
<input *ngSwitchCase="'checkbox'"
[formControlName]="property.key"
[id]="property.key"
[type]="'checkbox'"
(change)="checkChanged($event)"
[attr.checked]="property.value ? true : null">
checkChanged($event)
{
this.property.value = $event.target.checked;
this.form.get(this.property.key).setValue($event.target.checked);
}
Thanks @SigmaOutdoors I was going to get to that issue prior to upgrading to the next version of Angular. It is great to see you have dealt with it. I will have a look at what you did. I agree, the info on the deprecation from Angular is confusing.
Hey Jay, I don't think the checkboxes on properties are getting handled correctly, because we need to go after the 'selected' attribute to see if a checkbox is true or false. I am seeing different behavior on different widgets too. Like the barChart, I don't think any of those checkboxes return anything but true no matter what you do. However, on the Pie chart is returns a blank and I can map a blank to a false. Been in the digging in the code and I am not certain how to make a fix that would work across the board, if you have any ideas, let me know.