本文整理汇总了TypeScript中@angular/core.EmbeddedViewRef.destroy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript EmbeddedViewRef.destroy方法的具体用法?TypeScript EmbeddedViewRef.destroy怎么用?TypeScript EmbeddedViewRef.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.EmbeddedViewRef
的用法示例。
在下文中一共展示了EmbeddedViewRef.destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ifLoader
@Input() set ifLoader(loading: boolean) {
console.log('ifLoader, loading : ', loading);
if (loading) {
// create and attach a loader to our viewContainer
const factory = this.cfResolver.resolveComponentFactory(LoaderSpinnerComponent);
this.loaderComponentRef = this.viewContainer.createComponent(factory);
// remove any embedded view
if (this.embeddedViewRef) {
this.embeddedViewRef.destroy();
this.embeddedViewRef = null;
}
} else {
// remove any loader
if (this.loaderComponentRef) {
this.loaderComponentRef.destroy();
this.loaderComponentRef = null;
}
// create and attach our embeddedView
this.embeddedViewRef = this.viewContainer.createEmbeddedView(this.templateRef);
}
}
示例2: ngOnChanges
ngOnChanges(changes: { [key: string]: SimpleChange }) {
if (changes['templateWrapper']) {
if (this.embeddedViewRef) {
this.embeddedViewRef.destroy();
}
this.embeddedViewRef = this.viewContainer.createEmbeddedView(
this.templateWrapper, {
value: this.value,
row: this.row,
column: this.column
});
}
if (this.embeddedViewRef) {
this.embeddedViewRef.context.value = this.value;
this.embeddedViewRef.context.row = this.row;
this.embeddedViewRef.context.column = this.column;
}
}
示例3: ngOnDestroy
ngOnDestroy() {
this.view.destroy();
}