我在运行时在组件内创建按钮,而(单击)不是在监听事件
app.component.ts
{{1}}
答案 0 :(得分:1)
<button (click)="myFunc()"></button>
import { Component, OnInit } from "@angular/core";
@Component({
templateUrl:"button.html" //this is the component which has the above button html
})
export class App implements OnInit{
constructor(){}
ngOnInit(){
}
myFunc(){
console.log("function called");
}
}