当前位置: 首页>>代码示例>>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;未经允许,请勿转载。