I'm facing an issue with a close button in my HTML template that triggers a close() function in the component: HTML template:
<div>
<label id="radio-group-label">Please specify: </label>
<mat-radio-group
fxLayout="row"
aria-labelledby="radio-group-label"
class="radio-group"
formControlName="flWholeDay"
>
<mat-radio-button [checked]="wholeDayLeave" value="true"
>Whole day</mat-radio-button
>
<mat-radio-button [checked]="!wholeDayLeave" value="false"
>Part day</mat-radio-button
>
</mat-radio-group>
</div>
HTML button:
<button mat-raised-button fxLayoutAlign="center center" color="accent" (click)="close()">Close</button>
Component:
close() {
this.router.navigate(['/something']);
}
Whenever I click the button, it redirects to http://localhost:4200/something?mat-radio-group-0=true. What could be causing this strange behavior?