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


TypeScript Renderer2.createElement方法代码示例

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


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

示例1: ngAfterViewInit

 ngAfterViewInit() {
   this.preNode = this._renderer.createElement('pre');
   this.codeNode = this._renderer.createElement('code');
   this._renderer.addClass(this.codeNode, 'language-' + this.language);
   this._renderer.appendChild(this.nativeElement, this.preNode);
   this._renderer.appendChild(this.preNode, this.codeNode);
   this.codeNode.textContent = this.code;
   Prism.highlightElement(this.codeNode);
 }
开发者ID:gsuveti,项目名称:primeng-material,代码行数:9,代码来源:prism.component.ts

示例2: ngOnInit

 ngOnInit() {
   this.iElement = this.renderer.createElement('i');
   this.renderer.addClass(this.iElement, 'icon-prepend');
   this.renderer.addClass(this.iElement, 'fa');
   this.renderer.appendChild(this.elementRef.nativeElement, this.iElement);
   this.update();
 }
开发者ID:Abhishekvrshny,项目名称:ceph,代码行数:7,代码来源:password-button.directive.ts

示例3: ngOnInit

 ngOnInit() {
   const iElement = this.renderer.createElement('i');
   this.renderer.addClass(iElement, 'icon-prepend');
   this.renderer.addClass(iElement, 'fa');
   this.renderer.addClass(iElement, 'fa-clipboard');
   this.renderer.appendChild(this.elementRef.nativeElement, iElement);
 }
开发者ID:noahdesu,项目名称:ceph,代码行数:7,代码来源:copy2clipboard-button.directive.ts

示例4: setLabel

 setLabel(): void {
     if (!this.floatingLabel) {
         this.floatingLabel = this.renderer2.createElement('label');
         this.renderer2.appendChild(this.hostNativeElement, this.floatingLabel);
     }
     this.floatingLabel.innerHTML = this.label;
 }
开发者ID:dotCMS,项目名称:core-web,代码行数:7,代码来源:md-input-text.directive.ts

示例5: ngOnInit

 ngOnInit() {
   this.inputElement = document.getElementById(this.cdPasswordButton);
   this.iElement = this.renderer.createElement('i');
   this.renderer.addClass(this.iElement, 'icon-prepend');
   this.renderer.addClass(this.iElement, 'fa');
   this.renderer.appendChild(this.el.nativeElement, this.iElement);
   this.update();
 }
开发者ID:cy-lee,项目名称:ceph,代码行数:8,代码来源:password-button.directive.ts

示例6: ngOnInit

  ngOnInit() {
    this.renderer.setStyle(
      this.element.nativeElement, 'font-size','2em'
    );
    this.renderer.setStyle(
      this.element.nativeElement, 'color','yellow'
    );
    this.renderer.addClass(this.element.nativeElement, 'ok')    

    const h1 = this.renderer.createElement('h1');
    const text = this.renderer.createText('Click here to add h1');    
    this.renderer.appendChild(h1, text);

    this.renderer.appendChild(this.element.nativeElement, h1);

  }
开发者ID:iamkdev,项目名称:iamkdev.github.io,代码行数:16,代码来源:bold.directive.ts

示例7: ngOnInit

 ngOnInit(): void {
   // save old overflow
   if (this.lockScroll) {
     this.cacheOverflow = this.window.getComputedStyle(this.document.body).overflow
   }
   this.cacheModalElement = this.renderer.createElement('div')
   this.renderer.setAttribute(this.cacheModalElement, 'class', 'v-modal')
   this.renderer.setStyle(this.cacheModalElement, 'z-index', this.modalZindex)
   this.renderer.setStyle(this.cacheModalElement, 'display', this.visible ? 'block' : 'none')
   this.document.body.appendChild(this.cacheModalElement)
   // listen esc
   if (this.closeOnPressEscape) {
     this.globalListenFunc = this.renderer.listen(
     'document', 'keydown', (event: KeyboardEvent) => {
       this.visible && event.keyCode === 27 && this.closeHandler()
     })
   }
 }
开发者ID:weiwang94,项目名称:element-angular,代码行数:18,代码来源:dialog.ts

示例8: createScript

  createScript(src: string, renderer: Renderer2, elmRef?: ElementRef, callback?: () => void): HTMLScriptElement {
    const script = elmRef ? renderer.createElement('script') :
      this.getOwnerDocument().createElement('script');

    script.type = 'text/javascript';
    script.src = src;
    script.async = true;
    script.charset = 'UTF-8';
    script.id = `rebirth_script_${Math.random()}`;
    if (callback) {
      script.onreadystatechange = script.onload = () => {
        if ((!script.readyState || /loaded|complete/.test(script.readyState))) {
          callback();
        }
      };
    }
    renderer.appendChild(elmRef.nativeElement, script);
    return script;
  }
开发者ID:greengerong,项目名称:rebirth,代码行数:19,代码来源:rebirth-window.ts

示例9: createRipple

  createRipple(event) {
    if (this.rippleContainer.firstChild) {
      this.removeRipple();
    }

    const width = this.el.nativeElement.offsetWidth;
    const height = this.el.nativeElement.offsetHeight;
    const size = width > height ? width : height;
    const pos = this.el.nativeElement.getBoundingClientRect();
    const x = event.pageX - pos.left - (size / 2);
    const y = event.pageY - pos.top - (size / 2);

    const ripple = this.renderer.createElement('span');
    const style = {
      'top': y,
      'left': x,
      'height': size,
      'width': size
    };

    this.setRippleStyle(style, ripple);
    this.renderer.appendChild(this.rippleContainer, ripple);
  }
开发者ID:GrzegorzStanczyk,项目名称:Portfolio,代码行数:23,代码来源:ripple.directive.ts

示例10: createRippleContainer

 createRippleContainer() {
   this.rippleContainer = this.renderer.createElement('div');
   this.renderer.appendChild(this.el.nativeElement, this.rippleContainer);
 }
开发者ID:GrzegorzStanczyk,项目名称:Portfolio,代码行数:4,代码来源:ripple.directive.ts

示例11: createElement

 private createElement(r: Renderer2, name: string, namespace: string, id: number) {
   this._renderStore.store(r.createElement(name, namespace), id);
 }
开发者ID:Cammisuli,项目名称:angular,代码行数:3,代码来源:renderer.ts


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