【发布时间】:2021-05-01 11:28:40
【问题描述】:
这个问题可能会被问到,但这并不能解决我的问题。我有Angular 6 项目。在我的 ts 组件中,我添加了 button 标签。我尝试调用remove 方法,但它不起作用。
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
declare var $:any;
@Component({templateUrl: 'login.component.html'})
export class detectionRuleComponent implements OnInit {
constructor(
private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router) {}
ngOnInit() {}
addNewRow(){
var new_row = `<button (click)="remove($event)">Remove</button>`;
}
remove(){
alert();
}
}
当我点击删除按钮时,alert() 没有出现。请帮我解决这个问题。
【问题讨论】:
标签: javascript angular methods angular6