I have a list of checkboxes created with *ngFor. When the user select a checkbox, I display under the list another component. I've put routerLink on every checkbox basically, becase when the user clicks on a checkbox, the url should be updated with checkbox's id. The problem is that when I uncheck the checkbox, I want my checkbox's id to be remove from URL. How can I do that? I have something basic:
<span class="example-list-section">
<ul>
<li *ngFor="let subtask of task.subtasks">
<mat-checkbox [(ngModel)]="subtask.completed"
routerLink="{{subtask.id}}">
{{subtask.name}}
</mat-checkbox>
</li>
</ul>
</span>