當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。