I want to change image based on click . i have a two image
One

another one is

i want to do that when user click on lock button will be show the unlock and when user click on unlock button will be show the lock button
how can i do that please check it sir.
Hi@flycoders_sourav
You can do like this
HTML
<img src="{{myimage}}" (click)="addEvent();">
Ts
declare
public myimage = 'https://global.discourse-cdn.com/ionicframework/original/3X/c/f/cf7af661f0bae7cca915258f2b8d6b3937fccda4.png';
addEvent(){
if(this.myimage=='https://global.discourse-cdn.com/ionicframework/original/3X/c/f/cf7af661f0bae7cca915258f2b8d6b3937fccda4.png')
{
this.myimage='https://global.discourse-cdn.com/ionicframework/original/3X/e/5/e5001dfda25e215c0304eb79a9637d7fbd53ca73.png';
}else{
this.myimage = 'https://global.discourse-cdn.com/ionicframework/original/3X/c/f/cf7af661f0bae7cca915258f2b8d6b3937fccda4.png';
}
}
1 Like