Accessing certain buttons


#1

I have three buttons that uses the same Tap function. I want to pass the button or the button ID in to the Tap Funcation(HTML). Is that possible?

Here is my HTML Code:

<Button class=“tab-button” id=“Button-1” text=“Site Checker” (tap)=“onTap(this)”>

 <Button class="tab-button" id="Button-2" text="Features" (tap)="onTap(this)"></Button>
  <Button class="tab-button" id="Button-3" text="Release Notes"  (tap)="onTap(this)"></Button>

Here is my TypeScript code:

onTap(args) {
       var button = args.object;
       var id = button.id as string;
      for(let i = 0; i < this.tabList.length; i++){
          if (this.tabList[i].id == button.id) {
              if(!this.tabList[i].visible)
                  this.tabList[i].visible = true;             
          }
          else
          {
              this.tabList[i].visible = false;
          }
      }
   }

#2

I think with Angular you can do some passing into the binded events. With plain NS you cannot pass into the tap event so you have to do what your TS code appears to be doing. Trying to access the buttons id property :thumbsup: