How to get id and name value of button on click event in ionic 2 angular 2

Viewed 10820

I have a button

<button ion-button icon-left name="0x10000011 (click)="AppService.sendNotify($event)" id="0x10000011" value=1>
  <ion-icon name="camera"></ion-icon>
  CAM Icon
</button>

When I click on it, I want to get the id attribute in my service sendNotify function.

public sendNotify(data) {
  var method = 'SCAN_BUTTON';
  var name = data.target.name;
  var id = data.target.id;
  var value = data.target.value - 0;
  console.log("#$#$%$%^$%^#$%^#$%",method, name, value);
}

Here I am not getting the button id and name. Instead

#$#$%$%^$%^#$%^#$% SCAN_BUTTON undefined NaN.

Can anyone help me to find my error?

3 Answers
Related