當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.DynamicComponentLoader類代碼示例

本文整理匯總了TypeScript中angular2/core.DynamicComponentLoader的典型用法代碼示例。如果您正苦於以下問題:TypeScript DynamicComponentLoader類的具體用法?TypeScript DynamicComponentLoader怎麽用?TypeScript DynamicComponentLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DynamicComponentLoader類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: MdComponentPortalAttachedToDomWithoutOriginException

  /** Attach the given ComponentPortal to DOM element using the DynamicComponentLoader. */
  attachComponentPortal(portal: ComponentPortal): Promise<ComponentRef> {
    if (portal.origin == null) {
      throw new MdComponentPortalAttachedToDomWithoutOriginException();
    }

    return this._componentLoader.loadNextToLocation(portal.component, portal.origin).then(ref => {
      this._hostDomElement.appendChild(ref.hostView.rootNodes[0]);
      this.setDisposeFn(() => ref.dispose());
      return ref;
    });
  }
開發者ID:9590,項目名稱:material2,代碼行數:12,代碼來源:dom-portal-host.ts

示例2: ngAfterViewInit

 ngAfterViewInit() {
     this.componentLoader.loadNextToLocation(
         this.dialogInstance.componentType, this._viewRef, this.dialogInstance.modalDataBindings)
         .then((contentRef: ComponentRef) => {
             this.dialogInstance.contentRef = contentRef;
         });
 }
開發者ID:jdelgadoalfonso,項目名稱:angular2-modal,代碼行數:7,代碼來源:bootstrapModalContainer.ts

示例3: ngAfterViewInit

 ngAfterViewInit() {
     this._dlc
         .loadNextToLocation(this._compileConfig.component,
             this._viewContainer,
             this._compileConfig.bindings)
         .then(contentRef => this.dialog.contentRef = contentRef);
 }
開發者ID:admirkb,項目名稱:angular2-modal,代碼行數:7,代碼來源:bootstrapModalContainer.ts

示例4:

 .then(componentModule => {
     this.dynamicComponentLoader.loadIntoLocation(componentModule[component.fullName], this.elementRef, 'content')
         .then(component => {
             //component.instance.inputProperty = this.config.Calendar;
             //component.instance.inputValue = this.config.Calendar;
             component.instance.config = this.config;
         });
 });
開發者ID:dineyw23,項目名稱:BossyUI,代碼行數:8,代碼來源:app.component.ts

示例5:

 this.edgeService.getCoordinates().subscribe(coordinates => {
     this.dynamicComponentLoader
         .loadNextToLocation(Edge,coordinates.first.viewContainer)
         .then((res) => {
           res.instance.setCoordinates(coordinates.first, coordinates.second);
         })
         .catch(e => console.log(e));
 });
開發者ID:JDReutt,項目名稱:angular-2-samples,代碼行數:8,代碼來源:graph.ts

示例6: ngOnInit

 ngOnInit() {
   this.dcl.loadIntoLocation(this.type, this.element, 'ngTableCustom')
   .then((component) => {
       if (component.instance.ngTableOnInit) {
           component.instance.ngTableOnInit(this.index, this.row);
       }
   });
 }
開發者ID:dalvarado909,項目名稱:ng2-table,代碼行數:8,代碼來源:ng-table-custom.component.ts

示例7: CreateDynamicAlert

 private CreateDynamicAlert(alertBindings) {
      this.dynamicComponentLoader
        .loadIntoLocation(AlertComponent,this.element,'alertAppend', alertBindings)
        .then( comp => { 
            //We assign the componentRef to the instance
            comp.instance.contentRef(comp);
            console.log("Alert rendered with message: " + comp.instance.MessageContent);              
        }); 
 }  
開發者ID:CarlosLanderas,項目名稱:ng2-dynamicComponentLoader-demo,代碼行數:9,代碼來源:app.component.ts

示例8: ngOnInit

  ngOnInit() {
    const someDynamicHtml = `<p-o-c></p-o-c><h6>${Date.now()}</h6>`;

    this.loader.loadIntoLocation(
      compileToComponent(someDynamicHtml, [ProofOfConceptComponent]),
      this.elementRef,
      'container'
    );
  }    
開發者ID:GoodSoil,項目名稱:Ang2CourseNotes,代碼行數:9,代碼來源:dynamic-content.component.ts

示例9: initializeWidget

 private initializeWidget(widgetConfig: WidgetConfig) {
   let widgetComponent = this.getWidgetComponentByType(widgetConfig.type);
   let promise = this.dynamicComponentLoader.loadIntoLocation(widgetComponent, this.elementRef, 'widgets');
   Promise.resolve(promise).then(
     component => {
       component.instance.setUpdateInterval(1000);
       component.instance.initWidget(widgetConfig.id, widgetConfig.title);
       component.instance.updateWidgetData();
     });
 }
開發者ID:thombergs,項目名稱:infiniboard,代碼行數:10,代碼來源:dashboard.component.ts

示例10:

 return this.disposeDynCmp().then(() => {
   let component = this.popup.component;
   this.cmpRef = this.dcl.loadNextToLocation(component, this.dynCmp)
     .then(cmp => {
       if (this.popup.componentOptions) {
         cmp.instance.popupOptions = this.popup.componentOptions;
       }
       cmp.instance.popup = this.popup;
       return cmp;
     });
   this.visible = true;
 });
開發者ID:AdamFaron,項目名稱:FOO,代碼行數:12,代碼來源:popup.cmp.ts


注:本文中的angular2/core.DynamicComponentLoader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。