Get selected value button


#1

hello,
i want to make in ionic 2 some circles(buttons or examples) and when i press on button i get the value of the colors.
i just draw it and it si

mple to understand


Get button value
#2

You can try :
home.html–> <button (click)="getColor($event)" value="yellow">Yellow Button<button>
home.ts --> getColor(event){ console.log(event); }


#3

@prafulvats2017 thank you!
this is my solution:
home.html
<button ion-button *ngFor=“let colora of colors” [ngStyle]="{‘background-color’:colora}" (click)=“itemTapped($event, colora)” >

home.ts
colors=[’#011627’,’#F71735’,’#41EAD4’,’#FF9F1C’];
itemTapped(event, item) {
console.log(item);

it’s works fine!