One button can do 2 function


#1

can someone help me how i can get the coding where i just want one button can do 2 function. for example. when you click the button they can add but when u click back they will deleted.


#2

In html perspective, you can’t call 2 functions.

But we can do a trick here.

let me show an example,

in your html file

<button ion-button (click)="tempFunc()">Sample</button>

and in your ts file,

sampledata: boolean = false

tempFunc(){
if(sampledata==false){
sampledata = true;
this.falseFunc();
}
else{
sampledata = false;
this.falseFunc();
}


#3

See: How to create boolean function on Ionic