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


TypeScript core.Renderer2类代码示例

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


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

示例1: setContainerClass

 private setContainerClass(isOpen: boolean): void {
     if (isOpen) {
         this.renderer.addClass(this.elementRef.nativeElement, 'drawer-opened');
     } else {
         this.renderer.removeClass(this.elementRef.nativeElement, 'drawer-opened');
     }
 }
开发者ID:cedar-ave,项目名称:Fabric.Cashmere,代码行数:7,代码来源:drawer-container.component.ts

示例2: resetBackgroundColor

 /**
  * [resetBackgroundColor description]
  * @method resetBackgroundColor
  */
 public resetBackgroundColor(): void {
   if (this.currentBackgroundStyle) {
     this.renderer2.removeStyle(this.elementRef.nativeElement, this.currentBackgroundStyle.property, this.currentBackgroundStyle.color);
   } else if (this.currentBackgroundClass) {
     this.renderer2.removeClass(this.elementRef.nativeElement, this.currentBackgroundClass);
   }
 }
开发者ID:virtualghost4,项目名称:angular-admin-lte,代码行数:11,代码来源:color.service.ts

示例3: resetFontColor

 /**
  * [resetFontColor description]
  * @method resetFontColor
  * @return [description]
  */
 public resetFontColor() {
   if (this.currentFontStyle) {
     this.renderer2.removeStyle(this.elementRef.nativeElement, 'color', this.currentFontStyle);
   } else if (this.currentFontClass) {
     this.renderer2.removeClass(this.elementRef.nativeElement, this.currentFontClass);
   }
 }
开发者ID:virtualghost4,项目名称:angular-admin-lte,代码行数:12,代码来源:color.service.ts

示例4: handleAction

  handleAction({ target = null, visible = false }) {
    const addClass = visible ? 'active' : 'inactive';
    this.renderer.addClass(target, addClass);

    const rmClass = visible ? 'inactive' : 'active';
    this.renderer.removeClass(target, rmClass);
  }
开发者ID:k3nsei,项目名称:angular2-in-viewport,代码行数:7,代码来源:in-viewport.directive.spec.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: 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

示例7: alternateColors

  alternateColors(input: MdcLinearProgress) {
    const demoInput = 'demo-linear-progress--custom';

    input.elementRef.nativeElement.classList.contains(demoInput) ?
      this._renderer.removeClass(input.elementRef.nativeElement, demoInput)
      : this._renderer.addClass(input.elementRef.nativeElement, demoInput);
  }
开发者ID:cd8608,项目名称:angular-mdc-web,代码行数:7,代码来源:linear-progress-demo.ts

示例8: _setClass

 private _setClass(className: string, isAdd: boolean): void {
   if (isAdd) {
     this._renderer.addClass(this._element.nativeElement, className);
   } else {
     this._renderer.removeClass(this._element.nativeElement, className);
   }
 }
开发者ID:Promact,项目名称:md2,代码行数:7,代码来源:line.ts

示例9: performTransition

    private performTransition():void {
        if (!this._isReady || this._isAnimating || !this._queueFirst) {
            // Don't transition until we are ready, or if we are animating, or if there aren't any transitions in the queue.
            return;
        }

        this._isAnimating = true;

        const transition = this._queueFirst;

        // Set the Semantic UI classes for transitioning.
        transition.classes.forEach(c => this._renderer.addClass(this._element, c));
        this._renderer.addClass(this._element, `animating`);
        this._renderer.addClass(this._element, transition.directionClass);

        // Set the Semantic UI styles for transitioning.
        this._renderer.setStyle(this._element, `animationDuration`, `${transition.duration}ms`);
        this._renderer.setStyle(this._element, `display`, this._display);

        if (transition.direction === TransitionDirection.In) {
            // Unset hidden if we are transitioning in.
            this._isHidden = false;
        }

        // Wait the length of the animation before calling the complete callback.
        this._animationTimeout = window.setTimeout(() => this.finishTransition(transition), transition.duration);
    }
开发者ID:edcarroll,项目名称:ng2-semantic-ui,代码行数:27,代码来源:transition-controller.ts

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


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