I have a button with an image and text. When the button is clicked, I want to change both the image and content. Here's the code I'm currently using:
<div class="btn-default">
<button name="Save" [ngClass]="[bntStyle]" (click)="submit()">
<img class="img1" src="./image1.png"/><a
class="sidebarlinks" >Content1</a>
</button>
</div>
I also have other similar buttons in my project.
This is what my ts file looks like:
submit() {
this.bntStyle = 'btn-change';
}
In my css file, I have defined the following:
.btn-change {
background-image: url("./image1_after_click.png");
}
If anyone can assist me with this, I would greatly appreciate it. Thank you!