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


TypeScript core.RendererFactory2类代码示例

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


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

示例1: addInlineCodeToDocument

export function addInlineCodeToDocument(inlineCode: string, doc: Document, rendererFactory: RendererFactory2) {
  const renderType: RendererType2 = { id: '-1', encapsulation: ViewEncapsulation.None, styles: [], data: {} };
  const renderer = rendererFactory.createRenderer(doc, renderType);
  const script = renderer.createElement('script');
  renderer.setValue(script, inlineCode);
  renderer.insertBefore(doc.head, script, doc.head.firstChild);
}
开发者ID:jeffwhelpley,项目名称:preboot,代码行数:7,代码来源:server-preboot.module.ts

示例2: constructor

 constructor(
     private componentFactoryResolver: ComponentFactoryResolver,
     private appRef: ApplicationRef,
     private injector: Injector,
     rendererFactory: RendererFactory2,
 ) {
     this.renderer = rendererFactory.createRenderer(null, null);
 }
开发者ID:young891221,项目名称:pinpoint,代码行数:8,代码来源:dynamic-popup.service.ts

示例3: constructor

 /**
  * Constructor
  * @param rendererFactory
  */
 constructor(private rendererFactory: RendererFactory2) {
   this.renderer = rendererFactory.createRenderer(null, null);
 }
开发者ID:BoykoAlex,项目名称:spring-cloud-dataflow-ui,代码行数:7,代码来源:blocker.service.ts

示例4: Error

  /**
   * Inject the State into the bottom of the <head>
   */
  inject() {
    try {
      const document: any = this.state.getDocument();
      const transferStateString = JSON.stringify(this.toJson());
      const renderer = this.rendererFactory.createRenderer(document, {
        id: '-1',
        encapsulation: ViewEncapsulation.None,
        styles: [],
        data: {}
      });

      const head = document.head;
      if (head.localName !== 'head') {
        throw new Error(
          'Please have <head> as the first element in your document'
        );
      }

      const script = renderer.createElement('script');
      renderer.setValue(
        script,
        `window['TRANSFER_STATE'] = ${transferStateString}`
      );
      renderer.appendChild(head, script);
    } catch (e) {
      console.error(e);
    }
  }
开发者ID:sumanbh,项目名称:amazon-clone,代码行数:31,代码来源:server-transfer-state.ts

示例5: inject

  /**
   * Inject the State into the bottom of the <head>
   */
  inject() {
    try {
      const document: any = this.state.getDocument();
      const transferStateString = JSON.stringify(this.toJson());
      const renderer = this.rendererFactory.createRenderer(document, {
        id: '-1',
        encapsulation: ViewEncapsulation.None,
        styles: [],
        data: {}
      });

      const body = document.body;

      const script = renderer.createElement('script');
      renderer.setValue(script, `window['TRANSFER_STATE'] = ${transferStateString}`);
      renderer.appendChild(body, script);
    } catch (e) {
      console.log('Failed to append TRANSFER_STATE to body');
      console.error(e);
    }
  }
开发者ID:BHARAT703,项目名称:aspnetboilerplate-samples,代码行数:24,代码来源:server-transfer-state.ts

示例6: createRenderer

 private createRenderer(el: any, type: RendererType2, id: number) {
   this._renderStore.store(this._rendererFactory.createRenderer(el, type), id);
 }
开发者ID:Cammisuli,项目名称:angular,代码行数:3,代码来源:renderer.ts


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