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


TypeScript DynamicComponentLoader.loadNextToLocation方法代码示例

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


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

示例1: _loadTreeNodeContent

 _loadTreeNodeContent() {
   this.componentLoader.loadNextToLocation(this.treeModel.treeNodeContentComponent,
                                           this.viewContainerRef)
     .then((componentRef) => {
       componentRef.instance.node = this.node;
     });
 }
开发者ID:Rexota,项目名称:angular2-tree-component,代码行数:7,代码来源:tree-node-content.component.ts

示例2: createCmp

    createCmp(cmp, isDock = true)
    {
        window['cmpMap'] = window['cmpMap'] || {}
        window['cmpList'] = window['cmpList'] || {}
        const ref = this.dcl.loadNextToLocation(cmp, this.viewContainerRef)
        
        ref.then(ref=>
        {
                
                var name = ref['_componentType'].name
                const component = ref['_hostElement'].component
                    // console.log( 3333333,name)
                window['cmpList'][name] = window['cmpList'][name] || []
                window['cmpList'][name].push(ref)
                const id = idIndex++
                const element = $(ref['_hostElement']['nativeElement'])
                element.attr('id', id)
                window['cmpMap'][id] = ref
                
                if( !isDock )
                    return




            setTimeout(()=> 
            {
                if( name === 'UrlAppCmp' )
                    name = component.url
                
                ref.onDestroy(()=>{
                    dockMap[name].items.forEach((item, index)=>{
                        if( item._id === id )
                            dockMap[name].items.splice(index, 1)
                    })
                })    
                
                if( dockMap[name] ){
                    var data = { _id: id, title: component.title, element: element }
                    dockMap[name].items.push(data)
                    setTimeout(()=> {
                        data.title = component.title
                    }, 100);
                }
                else{
                    dockMap[name] = {_id: 'folder', items: [{ _id: id, title: component.title, element: element, component: component }], icon: component.dockbar_icon }
                    dockAppList.push(dockMap[name])
                    setTimeout(()=> {
                        dockMap[name].items[0].title = component.title
                    }, 1000);
                }
            })
            
        })
        
        return ref

        // return new 
    }
开发者ID:junjun16818,项目名称:webos,代码行数:59,代码来源:commander.ts

示例3:

 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:ManfredGit,项目名称:angular-2-samples,代码行数:8,代码来源:graph.ts

示例4: clicking

  clicking() {
    console.log('nir clicked');

    this.dcl.loadNextToLocation(FreeTextOperandTemplate, this.target)
      .then(cmpRef => {
        //cmpRef.instance.freeText.value = this.baz;
        console.log(cmpRef.instance.freeText);
      });
  }
开发者ID:nirpeer,项目名称:ng2-ruler,代码行数:9,代码来源:dashboard.component.ts

示例5: handleRouteChange

  handleRouteChange(def: RouteDefinition) {
    this.loader.loadNextToLocation(def.component, this.containerRef)
      .then((ref:ComponentRef<any>) => {
        // Clean up any old component that may not have finished animating out.
        this.destroyPreviousComponent(this.prevComponentRef);

        this.prevComponentRef = this.currComponentRef;
        this.currComponentRef = ref;

        // Clean up the old component after letting it animate out.
        setTimeout(this.destroyPreviousComponent.bind(this, this.prevComponentRef),
            MAX_VIEW_ANIMATION_DURATION);
      });
  }
开发者ID:levilindsey,项目名称:aldenwitt.com,代码行数:14,代码来源:router-outlet.component.ts

示例6: attachComponentPortal

  /** Attach the given ComponentPortal to this PortlHost using the DynamicComponentLoader. */
  attachComponentPortal(portal: ComponentPortal): Promise<ComponentRef<any>> {
    portal.setAttachedHost(this);

    // If the portal specifies an origin, use that as the logical location of the component
    // in the application tree. Otherwise use the location of this PortalHost.
    let viewContainerRef = portal.viewContainerRef != null ?
        portal.viewContainerRef :
        this._viewContainerRef;

    // Typecast is necessary for Dart transpilation.
    return this._dynamicComponentLoader.loadNextToLocation(portal.component, viewContainerRef)
      .then(ref => {
        this.setDisposeFn(() => ref.destroy());
        return ref;
      });
  }
开发者ID:AlexYates,项目名称:material2,代码行数:17,代码来源:portal-directives.ts

示例7: constructor

  constructor(dcl: DynamicComponentLoader, viewContainerRef: ViewContainerRef) {
  	
  	this.cities = [];
    this.cities.push({label:'New York', value:'New York'});
    this.cities.push({label:'Rome', value:'Rome'});
    this.cities.push({label:'London', value:'London'});
    this.cities.push({label:'Istanbul', value:'Istanbul'});
    this.cities.push({label:'Paris', value:'Paris'});

    this.selected = 'Rome';

    dcl.loadNextToLocation(Dropdown, viewContainerRef)
    .then((res) => {
      res.instance.options = this.cities;
      res.instance.value = this.selected;
    });

  }
开发者ID:evilkyro1965,项目名称:learn-angular2,代码行数:18,代码来源:boot.ts

示例8: constructor

 constructor(dcl: DynamicComponentLoader, viewContainerRef: ViewContainerRef) {
   dcl.loadNextToLocation(ChildComponent, viewContainerRef);
 }
开发者ID:evilkyro1965,项目名称:learn-angular2,代码行数:3,代码来源:boot.ts

示例9: constructor

 constructor(loader: DynamicComponentLoader, location: ViewContainerRef) {
   loader.loadNextToLocation(DummyComponent, location);
 }
开发者ID:0xJoKe,项目名称:angular,代码行数:3,代码来源:index.ts

示例10: loadComponent

 loadComponent() {
   this.dcl.loadNextToLocation(DynamicComponent, this.viewContainerRef)
     .then(componentRef => console.log('loadNextToLocation', componentRef));
 }
开发者ID:Xiahl1990,项目名称:augury,代码行数:4,代码来源:load-next-to-component.ts


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