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