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


TypeScript Renderer2.setAttribute方法代碼示例

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


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

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

示例2: ngOnChanges

 public ngOnChanges(changes: SimpleChanges) {
   if (this.mdlBadgeContent === null || typeof this.mdlBadgeContent === 'undefined'){
     this.renderer.removeAttribute(this.el, DATA_BADE_ATTR);
     return;
   }
   this.renderer.setAttribute(this.el, DATA_BADE_ATTR, this.mdlBadgeContent);
 }
開發者ID:mseemann,項目名稱:angular2-mdl,代碼行數:7,代碼來源:mdl-badge.directive.ts

示例3: it

        it('unknown', () => {
          const div = document.createElement('div');
          expect(div.hasAttribute('unknown:name')).toBe(false);

          renderer.setAttribute(div, 'name', 'value', 'unknown');

          expect(div.getAttribute('unknown:name')).toBe('value');
        });
開發者ID:DeepanParikh,項目名稱:angular,代碼行數:8,代碼來源:dom_renderer_spec.ts

示例4: constructor

 constructor(private element: ElementRef,
             private renderer: Renderer2,
             private hostService: HostService,
             private cd: ChangeDetectorRef) {
   this.renderer.addClass(this.element.nativeElement, 'slds-popover');
   this.renderer.addClass(this.element.nativeElement, 'slds-popover_tooltip');
   this.renderer.setAttribute(this.element.nativeElement, 'role', 'tooltip');
 }
開發者ID:ng-lightning,項目名稱:ng-lightning,代碼行數:8,代碼來源:tooltip.ts

示例5: ngOnInit

 ngOnInit() {
   this.renderer.setAttribute(this.elementRef.nativeElement, 'tabindex', '-1');
   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:noahdesu,項目名稱:ceph,代碼行數:8,代碼來源:password-button.directive.ts

示例6: shouldSetAttributeWithNs

        function shouldSetAttributeWithNs(namespace: string): void {
          const namespaceUri = NAMESPACE_URIS[namespace];
          const div = document.createElement('div');
          expect(div.hasAttributeNS(namespaceUri, 'name')).toBe(false);

          renderer.setAttribute(div, 'name', 'value', namespace);

          expect(div.getAttributeNS(namespaceUri, 'name')).toBe('value');
        }
開發者ID:DeepanParikh,項目名稱:angular,代碼行數:9,代碼來源:dom_renderer_spec.ts

示例7: nglOnPropertyChange

 nglOnPropertyChange(prop) {
   if (prop === 'uid') {
     this.renderer.setAttribute(this.element.nativeElement, 'id', this.uid);
   } else if (prop === 'placement') {
     this.nubbin = POSITION_MAP[this.placement].nubbin;
     this.setHostClass();
   } else if (prop === 'template') {
     this.cd.markForCheck();
   }
 }
開發者ID:ng-lightning,項目名稱:ng-lightning,代碼行數:10,代碼來源:tooltip.ts

示例8: constructor

 constructor(
   el: ElementRef,
   renderer: Renderer2,
   private settings: SettingsService,
   private router: Router,
   private titleSrv: TitleService,
   private modalSrv: NzModalService,
 ) {
   renderer.setAttribute(
     el.nativeElement,
     'ng-alain-version',
     VERSION_ALAIN.full,
   );
   renderer.setAttribute(
     el.nativeElement,
     'ng-zorro-version',
     VERSION_ZORRO.full,
   );
 }
開發者ID:jijiechen,項目名稱:openaspnetorg,代碼行數:19,代碼來源:app.component.ts

示例9: ngOnInit

    ngOnInit() {
        if(this.inputAttribut.code == '00100020' && this.inputAttribut.externalInternalAetMode == "external"){
            this.renderer.setAttribute(this.el.nativeElement, 'placeholder', this.inputAttribut.name);
        }else{
            if ((this.inputAttribut.code in Globalvar.IODPLACEHOLDERS) && _.hasIn(Globalvar.IODPLACEHOLDERS[this.inputAttribut.code], this.inputAttribut.mode)){
                if (Globalvar.IODPLACEHOLDERS[this.inputAttribut.code][this.inputAttribut.mode].action === 'replace' && this.el.nativeElement.tagName === 'INPUT'){
                    this.renderer.setAttribute(this.el.nativeElement, 'placeholder', Globalvar.IODPLACEHOLDERS[this.inputAttribut.code][this.inputAttribut.mode].placeholder);
                    this.renderer.setAttribute(this.el.nativeElement, 'title', Globalvar.IODPLACEHOLDERS[this.inputAttribut.code][this.inputAttribut.mode].placeholder);
                }
                if (Globalvar.IODPLACEHOLDERS[this.inputAttribut.code][this.inputAttribut.mode].action === 'disable'){
                    this.disableElement();
                }
            }else{
                if (this.inputAttribut.iod && !_.hasIn(this.inputAttribut.iod, this.inputAttribut.code)){
                    this.disableElement();
                }
                this.renderer.setAttribute(this.el.nativeElement, 'placeholder', this.inputAttribut.name);
            }
        }

    }
開發者ID:dhanzhang,項目名稱:dcm4chee-arc-light,代碼行數:21,代碼來源:placeholderchanger.directive.ts

示例10: setAttributes

 private setAttributes(tries: number = 0) {
     if (tries > 20) { return; }
     if (this.field.attributes && this.field.attributes.length > 0) {
         if (this.input && this.input.nativeElement) {
             for (const attr of this.field.attributes) {
                 this.renderer.setAttribute(this.input.nativeElement, attr.name, attr.value);
             }
         } else {
             this.timeout('set_attributes', () => this.setAttributes(++tries));
         }
     }
 }
開發者ID:acaprojects,項目名稱:a2-widgets,代碼行數:12,代碼來源:dynamic-field.component.ts


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