當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Renderer2.appendChild方法代碼示例

本文整理匯總了TypeScript中@angular/core.Renderer2.appendChild方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Renderer2.appendChild方法的具體用法?TypeScript Renderer2.appendChild怎麽用?TypeScript Renderer2.appendChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/core.Renderer2的用法示例。


在下文中一共展示了Renderer2.appendChild方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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.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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: initPopup

    private initPopup({data, coord, component, onCloseCallback}: IPopupParam): void {
        this.componentRef = this.componentFactoryResolver.resolveComponentFactory<DynamicPopup>(component).create(this.injector);
        const popupComponent = this.componentRef.instance;
        const domElem = (this.componentRef.hostView as EmbeddedViewRef<DynamicPopup>).rootNodes[0] as HTMLElement;

        this.bindInputProps(popupComponent, data, coord);
        this.bindOutputProps(popupComponent, domElem, onCloseCallback);
        this.renderer.addClass(domElem, 'popup');
        this.renderer.appendChild((this.appRef.components[0].location).nativeElement, domElem);
        this.appRef.attachView(this.componentRef.hostView);
    }
開發者ID:young891221,項目名稱:pinpoint,代碼行數:11,代碼來源:dynamic-popup.service.ts

示例8: inlineSvgContent

  private inlineSvgContent(svg: SVGElement) {
    const el = this.elementRef.nativeElement;
    el.innerHTML = '';

    if (this.scaleToContainer) {
      this.renderer.setAttribute(svg, 'width', '100%');
      this.renderer.setAttribute(svg, 'height', '100%');
      this.renderer.setAttribute(svg, 'preserveAspectRatio', 'xMidYMid meet');
    }
    this.renderer.appendChild(el, svg);
  }
開發者ID:macliems,項目名稱:JixyFront,代碼行數:11,代碼來源:svg-viewer.component.ts

示例9: 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

示例10: 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


注:本文中的@angular/core.Renderer2.appendChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。