button onclick angular 9 code example
Example 1: onclick event in angular
(click)="myClickFunction($event)"
Example 2: onclick function in angular
import { Component } from "@angular/core";
@Component({
templateUrl:"home.html"
})
export class HomePage {
public items: Array<string>;
constructor() {
this.items = ["item1", "item2", "item3"]
}
public open(event, item) {
alert('Open ' + item);
}
}