Necesito saber si los checkbox están checked para almacenar o no los datos.
Tengo el siguiente checkbox:
<mat-radio-button color="primary" *ngIf="type === 'category'" class="example-margin" value="{{d.value}}" (change)="onChange($event)">{{d.text}}</mat-radio-button>
Y tengo esto en el typescript:
onChange(event) {
let data = {};
if (this.type === 'category') {
data[this.type + 'Id'] = event.value;
this.noticeService.addToStepsData(this.stepsData, data, this.type);
}
else if (this.type === 'brand') {
data[this.type + 'Id'] = event.source.value;
this.array.push(data);
this.noticeService.addToStepsData(this.stepsData, this.array, this.type);
}}
En el else if
antes de hacer el push
necesito pasarle la validación con if
para saber si esta checked o no.