js --onclick
jquery--click
vue--@click
React--onClick
Angular--(click)
1、*ngFor
<div (click)="handleClick()">{{title}}</div>
<div *ngFor="let item of lists">
{{item}}
</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-app';
lists:Array<number> = [1,2,3];
constructor(public http:HttpClient){}
handleClick():void{
console.log(this.title)
this.title = "change"
}