I want to change image based on click

I want to change image based on click . i have a two image
One
red-button
another one is
green-button

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

Great. its working fine