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


TypeScript elements.createCustomElement函数代码示例

本文整理汇总了TypeScript中@angular/elements.createCustomElement函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createCustomElement函数的具体用法?TypeScript createCustomElement怎么用?TypeScript createCustomElement使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: constructor

  constructor(public injector: Injector) {
    // shakemap-station constructor will be an HTMLElement if it's not
    // registered yet
    const stationConst = document.createElement('shakemap-station').constructor;

    if (stationConst === HTMLElement) {
      // shakemap-station element is not yet registered
      const station = createCustomElement(StationComponent, { injector });
      customElements.define('shakemap-station', station);
    }

    // create dyfi-response-popup
    const dyfiPopupConst = document.createElement('dyfi-response').constructor;

    if (dyfiPopupConst === HTMLElement) {
      // dyfi popup element is not yet registered
      const dyfiPopup = createCustomElement(DyfiResponsePopupComponent, {
        injector
      });
      customElements.define('dyfi-response', dyfiPopup);
    }

    // create finite-fault map popup
    const ffPopupConst = document.createElement('finite-fault-map-popup')
      .constructor;

    if (ffPopupConst === HTMLElement) {
      // finite fault popup is not yet registered
      const ffPopup = createCustomElement(FiniteFaultMapPopupComponent, {
        injector
      });
      customElements.define('finite-fault-map-popup', ffPopup);
    }
  }
开发者ID:emartinez-usgs,项目名称:earthquake-eventpages,代码行数:34,代码来源:shared.module.ts

示例2: createCustomElement

 register<T>(moduleRef: NgModuleRef<any>, component: Type<T>) {
     //console.log(moduleRef);
     const componentFactory = moduleRef.componentFactoryResolver.resolveComponentFactory<T>(component);
     //console.log(componentFactory);
     // const ngElementConfig = getConfigFromComponentFactory(componentFactory, moduleRef.injector);
     const ngElementCtor = createCustomElement(component, { injector: moduleRef.injector });
     //console.log(ngElementCtor);
     customElements.define(componentFactory.selector, ngElementCtor);
 }
开发者ID:liquidboy,项目名称:GameOn,代码行数:9,代码来源:canvas.module.ts

示例3: ngOnInit

  ngOnInit() {
    let exampleElementCtor = customElements.get(this.id);

    if (!exampleElementCtor) {
      exampleElementCtor =
          createCustomElement(EXAMPLE_COMPONENTS[this.id].component, {injector: this._injector});

      customElements.define(this.id, exampleElementCtor);
    }

    this._elementRef.nativeElement.appendChild(new exampleElementCtor(this._injector));
  }
开发者ID:Nodarii,项目名称:material2,代码行数:12,代码来源:example-viewer.ts

示例4: ngDoBootstrap

  ngDoBootstrap() {
    const elements: any[] = [
      [GoogleLoginComponent, 'google-login'],
      [ThemeBtnComponent, 'theme-btn'],
      [LazyComponent, 'lazy-content'],
      [RouteLoaderComponent, 'route-loader'],
      [UserProfileComponent, 'user-profile'],
      [AlgoliaSearchComponent, 'algolia-search'],
      [AlgoliaButtonComponent, 'algolia-button'],
      [VideoPlayerComponent, 'video-player'],
      [SlackMirrorComponent, 'slack-mirror'],
      [TogglerComponent, 'menu-toggler'],
      [NotificationComponent, 'app-notification']
    ];

    for (const [component, name] of elements) {
      const el = createCustomElement(component, { injector: this.injector });
      customElements.define(name, el);
    }
  }
开发者ID:janjachacz,项目名称:fireship.io,代码行数:20,代码来源:app.module.ts

示例5: constructor

  constructor(private injector: Injector) {
    const madeWithLoveElement = createCustomElement(MadeWithLoveComponent, { injector });

    customElements.define('made-with-love', madeWithLoveElement);
  }
开发者ID:jrsglobalpriv,项目名称:made-with-love,代码行数:5,代码来源:made-with-love.module.ts

示例6: constructor

 constructor(private injector: Injector) {
   customElements.define('hello-world-el', createCustomElement(HelloWorldComponent, {injector}));
   customElements.define(
       'hello-world-shadow-el', createCustomElement(HelloWorldShadowComponent, {injector}));
   customElements.define('test-card', createCustomElement(TestCardComponent, {injector}));
 }
开发者ID:DeepanParikh,项目名称:angular,代码行数:6,代码来源:app.ts

示例7: constructor

  constructor(private injector: Injector) {
    const tileElm = createCustomElement(DashboardTileComponent, { injector: this.injector });

    customElements.define('dashboard-tile', tileElm);
  }
开发者ID:yperrin,项目名称:Experiments,代码行数:5,代码来源:dashboard-tile.module.ts

示例8: constructor

 constructor(private injector: Injector, public popup: PopupService) {
   // on init, convert PopupComponent to a custom element
   const PopupElement = createCustomElement(PopupComponent, { injector: this.injector });
   // register the custom element with the browser.
   customElements.define('popup-element', PopupElement);
 }
开发者ID:Smilehwj,项目名称:pupupsample,代码行数:6,代码来源:app.component.ts

示例9: ngDoBootstrap

 ngDoBootstrap() {
   const elm = createCustomElement(AppComponent, { injector: this.injector });
   customElements.define('custom-element', elm);
 }
开发者ID:meeroslav,项目名称:ngx-build-plus,代码行数:4,代码来源:app.module.ts

示例10: createCustomElement

 Object.keys(EXAMPLE_COMPONENTS).forEach(key => {
   const element = createCustomElement(EXAMPLE_COMPONENTS[key].component, {injector});
   customElements.define(key, element);
 });
开发者ID:OkBayat,项目名称:material2,代码行数:4,代码来源:demo-module.ts


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