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


TypeScript Renderer2.addClass方法代碼示例

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


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

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

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

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

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

示例6: update

 private update() {
   if (this.inputElement.type === 'text') {
     this.renderer.removeClass(this.iElement, 'fa-eye');
     this.renderer.addClass(this.iElement, 'fa-eye-slash');
   } else {
     this.renderer.removeClass(this.iElement, 'fa-eye-slash');
     this.renderer.addClass(this.iElement, 'fa-eye');
   }
 }
開發者ID:cy-lee,項目名稱:ceph,代碼行數:9,代碼來源:password-button.directive.ts

示例7: update

 private update() {
   const inputElement = this.getInputElement();
   if (inputElement && inputElement.type === 'text') {
     this.renderer.removeClass(this.iElement, 'fa-eye');
     this.renderer.addClass(this.iElement, 'fa-eye-slash');
   } else {
     this.renderer.removeClass(this.iElement, 'fa-eye-slash');
     this.renderer.addClass(this.iElement, 'fa-eye');
   }
 }
開發者ID:noahdesu,項目名稱:ceph,代碼行數:10,代碼來源:password-button.directive.ts

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

示例9: alternateColors

  alternateColors(input: MdcRadio) {
    const demoInput = 'demo-radio--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,代碼來源:radio-demo.ts

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

示例11: setHiddenClass

 private setHiddenClass(hideableColumnValue: boolean) {
     if (hideableColumnValue) {
         this._renderer.addClass(this._el.nativeElement, "datagrid-cell--hidden");
     } else {
         this._renderer.removeClass(this._el.nativeElement, "datagrid-cell--hidden");
     }
 }
開發者ID:beqom,項目名稱:clarity,代碼行數:7,代碼來源:datagrid-cell.ts

示例12: alternateColors

  alternateColors(icon: MdcIcon) {
    const demoIcon = 'demo-icon-custom-colors';

    icon.elementRef.nativeElement.classList.contains(demoIcon) ?
      this._renderer.removeClass(icon.elementRef.nativeElement, demoIcon)
      : this._renderer.addClass(icon.elementRef.nativeElement, demoIcon);
  }
開發者ID:cd8608,項目名稱:angular-mdc-web,代碼行數:7,代碼來源:icon-demo.ts

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

示例14: _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

示例15: updateStatus

 private updateStatus(add: boolean) {
   if (add) {
     this.renderer.addClass(this.elmRef.nativeElement, 'hidden');
     return;
   }
   this.renderer.removeClass(this.elmRef.nativeElement, 'hidden');
 }
開發者ID:greengerong,項目名稱:rebirth,代碼行數:7,代碼來源:loading.component.ts


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