on click in angular code example

Example 1: onclick event in angular

(click)="myClickFunction($event)"

Example 2: angular click event

<button (click)="FunctionName()">TEST</button>

Example 3: click binding angular 8

<button (click)="myFunction()"></button>

Example 4: 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);
  }

}

Tags:

Html Example