问题描述
我有以下情况:指令检测到ElementRef发生的更改,并在销毁它时执行操作:
模板:
<input doSomethingOnDestory *ngIf="showMyInput" type="text" [(ngModel)]="myInput">
指令:
@Directive({
selector: '[ngModel][doSomethingOnDestory]'
})
export class DoSomethingOnDestory Directive implements OnDestroy {
@Output() ngModelChange: EventEmitter<any> = new EventEmitter();
constructor(){}
ngOnDestroy() {
//Do something to the model
}
}
现在,我进入一种情况,仅在组件自身被破坏(例如,//Do something to the model
虚假)时才运行showMyInput
而不是通过“外部驱逐舰”(例如,表单的整个包装组件都被摧毁)
我该怎么做?
谢谢:-)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)