I have 3 divs and having the click event, I am handling the click event using a function in each event.Now suppose I don't want the click event for click3, that I need to control with parameter in function. I am not getting how to make it. Here is the code below https://stackblitz.com/edit/angular-9o3hgv?file=src%2Fapp%2Fapp.component.ts
app.component.html
<hello name="{{ name }}"></hello>
<p>
Start editing to see some magic happen :)
</p>
<div (click)="click1()">Click1</div>
<div (click)="click2()">Click2</div>
<div (click)="click3()">Click3</div>
app.component.ts
import { Component } from "@angular/core";
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
name = "Angular";
function1() {
alert("hi");
}
click1() {
this.function1();
}
click2() {
this.function1();
}
click3() {
this.function1();
}
}