我尝试在指令主体中执行此操作:
let fn = () => {
alert("ok");
};
export class DirDirective {
this.vcr.createEmbeddedView(this.tpl, {
$implicit: num,
fn: fn
});
}
模板是:
<ng-container *dir="true; let num; let fn=fn">
<option (click)="fn"></option>
</ng-container>
当我点击时:
(click)="fn"
它不调用函数let fn = () => {}
我的想法是动态更改处理程序的单击次数