Hy, So I have a checkbox group with 3 items. I created it with Angular 5.0.5 and Clarity vm. I want my function to check if at least one of the checkboxes is checked and THEN go at the next page, which is a wizard. Until now the wizard opens without checking if at least one checkbox is selected.
My html looks like this:
`<table class="table">
<tbody>
<tr *ngFor="let item of items">
<td>
<input type="checkbox" name="allowNext" [(ngModel)]="item.chosen">
</td>
<td>
</td>
</tr>
</tbody>
</table>
<br>
</form>
<button [disabled] class="btn btn-primary" (click)="go()"> Next </button>`
my Typescript for it looks like this:
` items= [
{name: 'checkbox1', chosen: false},
{name: 'checkbox2', chosen: false},
{name: 'checkbox3', chosen: false}
];
go() {
if(this.items.chosen === true) {
this.wizard.open();
ngOnInit () {}
constructor( public router: Router) {}`
could you guys please help me define the function correclty? Thanks in advanced!
Aucun commentaire:
Enregistrer un commentaire