You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot disable it. there are multiple switches in the grid I need to show a message when more than 5 switches are in ON state. and also prevent the action of the switch.
Had not thought of that. I'm gonna search for the best solution and see if exist a way to do this. For now, maybe a quick solution can be this:
HTML:
<bSwitch*ngFor="let plan of club.plans"
[(ngModel)]="plan.isFeatured"
(click)="onClick(club.Isactive && !plan.isFeatured)"
[switch-disabled]="club.Isactive && !plan.isFeatured"
(onChangeState)="checkPlans($event,club)" ></bSwitch>
Component:
checkPlans(event,club){letactivePlans=club.plans.filter((item)=>{returnitem.isFeatured;}).length;club.Isactive=(activePlans==5);}onClick(flag){if(flag){// Do something}}
If you just want to show a div or something like that, you just need to use the club.Isactive
html:-
<bSwitch [(ngModel)]="club.plans[0].IsFeatured"
(onChangeState)="updateclubs($event, club)">
Component Code:-
updateclubs(event, club) {
i need to prevent the switch incase when club is inactive. StopPropagation method is also not available.
The text was updated successfully, but these errors were encountered: