当前位置: 首页>>代码示例>>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;未经允许,请勿转载。