当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ComponentRef.destroy方法代码示例

本文整理汇总了TypeScript中@angular/core.ComponentRef.destroy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ComponentRef.destroy方法的具体用法?TypeScript ComponentRef.destroy怎么用?TypeScript ComponentRef.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/core.ComponentRef的用法示例。


在下文中一共展示了ComponentRef.destroy方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 dialog.onDestroy.subscribe( () => {
   if (typeof cmpRef.instance.canDestroy === 'function') {
     cmpRef.instance.canDestroy().then ( () => cmpRef.destroy() );
   } else {
     cmpRef.destroy();
   }
 });
开发者ID:Anand024,项目名称:angular2-modal,代码行数:7,代码来源:dom-modal-renderer.ts

示例2: ngOnDestroy

 /**
  * On destroy
  */
 ngOnDestroy(): void
 {
     if ( this.previewRef )
     {
         this.previewRef.destroy();
     }
 }
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:10,代码来源:example-viewer.ts

示例3: 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);
    }
  }
开发者ID:guillaumeLeRoy,项目名称:eritis_fe,代码行数:25,代码来源:if.directive.ts

示例4: cleanup

    protected cleanup():void {
        super.cleanup();

        if (this._contentComponentRef) {
            this._contentComponentRef.destroy();
            this._contentComponentRef = undefined;
        }
    }
开发者ID:edcarroll,项目名称:ng2-semantic-ui,代码行数:8,代码来源:popup-component-controller.ts

示例5: removeDrawerElements

  private removeDrawerElements() {
    const windowNativeEl = this.drawerCmptRef.location.nativeElement;
    windowNativeEl.parentNode.removeChild(windowNativeEl);
    this.drawerCmptRef.destroy();

    if (this.backdropCmptRef) {
      const backdropNativeEl = this.backdropCmptRef.location.nativeElement;
      backdropNativeEl.parentNode.removeChild(backdropNativeEl);
      this.backdropCmptRef.destroy();
    }

    if (this.contentRef && this.contentRef.viewRef) {
      this.contentRef.viewRef.destroy();
    }

    this.drawerCmptRef = null;
    this.contentRef = null;
  }
开发者ID:marlonprudente,项目名称:composer,代码行数:18,代码来源:drawer-ref.ts

示例6:

      this._resolver.resolveComponent(this.pageComponentType).then(factory => {
        if (this._pageComponent) {
          this._pageComponent.destroy();
        }
        this._pageComponent = this._viewContainer.createComponent(factory, 0, this._viewContainer.injector);

        // dirty fix to insert in correct position
        const pageElement = this._pageComponent.location.nativeElement
        this._elementRef.nativeElement.appendChild(pageElement);
      });
开发者ID:iamjay,项目名称:OnsenUI,代码行数:10,代码来源:ons-splitter.ts

示例7: _removeModalElements

  private _removeModalElements() {
    const windowNativeEl = this._windowCmptRef.location.nativeElement;
    windowNativeEl.parentNode.removeChild(windowNativeEl);
    this._windowCmptRef.destroy();

    if (this._backdropCmptRef) {
      const backdropNativeEl = this._backdropCmptRef.location.nativeElement;
      backdropNativeEl.parentNode.removeChild(backdropNativeEl);
      this._backdropCmptRef.destroy();
    }

    if (this._contentRef && this._contentRef.viewRef) {
      this._contentRef.viewRef.destroy();
    }

    this._windowCmptRef = null;
    this._backdropCmptRef = null;
    this._contentRef = null;
  }
开发者ID:ExFlo,项目名称:ng-boostrap,代码行数:19,代码来源:modal-ref.ts

示例8:

      this.setDisposeFn(() => {
        (this._appRef as any).unregisterChangeDetector(changeDetectorRef);

        // Normally the ViewContainer will remove the component's nodes from the DOM.
        // Without a ViewContainer, we need to manually remove the nodes.
        let componentRootNode = this._getComponentRootNode(componentRef);
        if (componentRootNode.parentNode) {
          componentRootNode.parentNode.removeChild(componentRootNode);
        }

        componentRef.destroy();
      });
开发者ID:dharmeshpipariya,项目名称:md2-datepicker,代码行数:12,代码来源:dom-portal-host.ts

示例9: _removeModalElements

  private _removeModalElements() {
    const notificationNativeEl = this._notificationCmptRef.location.nativeElement;
    notificationNativeEl.parentNode.removeChild(notificationNativeEl);
    this._notificationCmptRef.destroy();

    if (this._contentRef && this._contentRef.viewRef) {
      this._contentRef.viewRef.destroy();
    }

    this._notificationCmptRef = null;
    this._contentRef = null;
  }
开发者ID:RubenGantner,项目名称:clarity-addons,代码行数:12,代码来源:notification-ref.ts

示例10: ngAfterViewInit

 ngAfterViewInit() {
   if (this.column.def.component) {
     if (this.componentRef) {
       this.componentRef.destroy();
     }
     const cmpFactory = this.resolver.resolveComponentFactory(this.column.def.component);
     const ctxInjector: Injector = this.cmpContainer.injector;
     this.componentRef = this.cmpContainer.createComponent(cmpFactory, 0, ctxInjector);
     const instance: any = this.componentRef.instance;
     instance['row'] = this.row;
     instance['column'] = this.column;
     instance['key'] = this.column.def.key;
     instance['value'] = this.getValue();
     this.componentRef.changeDetectorRef.detectChanges();
   }
 }
开发者ID:andyperlitch,项目名称:ng2-super-table,代码行数:16,代码来源:table-cell.component.ts


注:本文中的@angular/core.ComponentRef.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。