mituri

[NG] Add active class on multiple buttons

Feb 7th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. HTML:
  2. <Label
  3. [text]="teeeexxxttt"
  4. (tap)="setActiveBadge(3)"
  5. [ngClass]="{ 'active': activeBadgePositon === 3 }"
  6. class="badge"
  7. ></Label>
  8.  
  9. TS:
  10. public activeBadgePositon: number = 1
  11.  
  12. public setActiveBadge(position: number) {
  13. this.activeBadgePositon = position
  14. }
Advertisement
Add Comment
Please, Sign In to add comment