【发布时间】:2019-05-02 20:52:30
【问题描述】:
当我点击测试时,点击函数应该被调用。 但是什么都没有触发。
HTML 组件:
<div class="row m-0 justify-content-between" *ngFor="let i of
k[currentk]?.details | keys">
<div (click)="test(i.name)">{{i.name}}</div>
</div>
ts 组件:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
constructor() {}
ngOnInit() {}
test(name){
alert('Hello world');
}
}
【问题讨论】:
-
欢迎来到堆栈溢出。请使用tour(stackoverflow.com/tour) 并阅读How to ask 以及如何创建Minimal , Complete and verifiable example。
-
贴出你的测试功能代码
-
@sid 查看我发布的问题
标签: javascript angular html css