Ion-checkbox limit the number of maximum checked boxes

Hello, on ion-checkbox how can we limit the number of maximum checked boxes to 5?

This mean the other box will not be able to be checked unless the user deselect a box.

We need the code if possible thanks.

We tried this:
<ion-checkbox [(ngModel)]=“lst.checked” (ionChange)=“handleOnCheckEvent(lst2)”>

//arry contain the cheked element
if( this.arry.length > 5 ){

It’s not a good solution us it let the user select the box and than deselect it .

You will have to code this functionality in Angular, as it is not a function of the checkbox component.

Of corse i coded it but there is bug on it, it work for the first click and then it stop working correctly.

hi @forevermo , I’ve got the same problem , do you solved it ?

Hi, no right now there is no solution with native ionic.
The solution: hard coded it, i changed the way how it work with HTML and TypeScript