【发布时间】:2018-08-30 07:30:19
【问题描述】:
我想在点击 div 时初始化一个组件,这是我的代码
在 html 文件中
<li *ngFor="let contact of contactList">
<div (click)="anyFunctionName($event,contact.id)">
</div></li>
<component-selector></component-selector>
在ts文件中
anyFunctionName(event,id):any{
// I will do some stuff,
and output will be goes to another component html file,
that will call another component <component-selector></component-selector> and display the output there
}
有什么想法吗?
谢谢
【问题讨论】:
-
我不确定这是您要找的,但请尝试阅读此处:angular.io/guide/dynamic-component-loader
标签: typescript angular5