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


TypeScript ViewContainerRef.insert方法代码示例

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


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

示例1: addComponent

 addComponent() {
   const factory = this.componentFactoryResolver.resolveComponentFactory(AppChart);
   const ref = this.viewContainerRef.createComponent(factory);
   ref.changeDetectorRef.detectChanges();
   // We insert the component into the dom container
   this.dynamicComponentContainer.insert(ref.hostView);
   this.numElements = this.dynamicComponentContainer.length;    
   this.currentComponent = ref.instance;
   this.container.push(ref.instance);
 }
开发者ID:joergkrause,项目名称:mvc2ng,代码行数:10,代码来源:pagedesigner.ts

示例2: createComponent

  public createComponent(data: any): void {
    const injector = ReflectiveInjector.resolveAndCreate([]);
    const factory = this.resolver.resolveComponentFactory(data.component);
    const component = factory.create(injector);

    this.dynamicComponentContainer.insert(component.hostView);

    if (this.currentComponent) {
      this.currentComponent.destroy();
    }

    this.currentComponent = component;
  }
开发者ID:blackbaud,项目名称:skyux2,代码行数:13,代码来源:demo-generator.component.ts

示例3: ngOnInit

 ngOnInit() {
     //ValueProvider { provide: any; useValue: any;}
     // let providers = [{ provide: "item", useValue: this.item }, { provide: "column", useValue: this.column }];
     // let inputs = ReflectiveInjector.resolve(providers);
     let injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector);
     let component;
     if (this.column.cell) {
         let factory = this.resolver.resolveComponentFactory(this.column.cell);
         component = factory.create(injector);
     } else {
         let factory = this.resolver.resolveComponentFactory(DefaultCellComponent);
         component = factory.create(injector);
     }
     component.instance.column = this.column;
     component.instance.item = this.item;
     this.vcRef.insert(component.hostView);
 }
开发者ID:jacekcgi,项目名称:planeRepo,代码行数:17,代码来源:cell.component.ts

示例4:

 return promise.then((entity) => {
   const component = componentFactory.create(viewContainerRef.parentInjector);
   const instance = component.instance;
   instance.client = client;
   if (entity) {
     (
       instance as INgorEntityDetailComponent<Query, Params, EntityCreateDto, EntityUpdateDto, EntityDto>
     ).entity = this._entity = entity;
   }
   if (step) {
     (
       instance as INgorStepComponent<Query, Params, EntityCreateDto, EntityUpdateDto, EntityDto>
     ).step = this._step = step;
   }
   instance.resource = resource;
   viewContainerRef.clear();
   return viewContainerRef.insert(component.hostView);
 });
开发者ID:santech-org,项目名称:ng-on-rest,代码行数:18,代码来源:resource-components.service.ts

示例5: Error

      this.route.url.subscribe(urls => {
        const p = [];
        urls.forEach(url => {
          p.push(url.path);
        });
        const path = p.join('/');
        this.screen = this.reg.screens[this.route.routeConfig.path];

        if (!this.screen) {
          throw new Error('Screen not found in registry');
        }
        const factory = this.resolver.resolveComponentFactory<any>(this.screen.component);
        const componentRef = this.container.createComponent(factory);
        this.title.setTitle(this.screen.title);
        componentRef.instance.viewConfig = this.screen;
        Object.keys(this.route.snapshot.params).forEach(k => {
          componentRef.instance[k] = this.route.snapshot.params[k];
        });
        this.dynamicComponentContainer.insert(componentRef.hostView);
      });
开发者ID:CloudInn,项目名称:ng-crud-ui,代码行数:20,代码来源:screen-wrapper.component.ts

示例6:

 changes.forEachAddedItem((record: IterableChangeRecord<T>) => {
   const view = this.viewContainerRef.createEmbeddedView(this.templateRef);
   this.viewContainerRef.insert(view);
   view.context.$implicit = record.item;
 });
开发者ID:rimlin,项目名称:ng-easy-list,代码行数:5,代码来源:easy-list-for.directive.ts

示例7:

 // Inserts the component into the specified view container.
 public attachToView<T>(componentRef:ComponentRef<T>, viewContainer:ViewContainerRef):void {
     viewContainer.insert(componentRef.hostView, 0);
 }
开发者ID:edcarroll,项目名称:ng2-semantic-ui,代码行数:4,代码来源:component-factory.service.ts

示例8:

 ).subscribeTracked(this, () => {
     this.componentView.insert(this.component.hostView);
 });
开发者ID:hmenager,项目名称:composer,代码行数:3,代码来源:notification.component.ts


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