Skip to content

Commit

Permalink
Fixed #12216 - ToggleButton | Label of basic button is unexpectedly s…
Browse files Browse the repository at this point in the history
…hifted to the left
  • Loading branch information
cetincakiroglu committed Nov 29, 2022
1 parent 4e4f798 commit b9cda4b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/components/togglebutton/togglebutton.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule, Component, Input, Output, EventEmitter, forwardRef, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, forwardRef, Input, NgModule, Output } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { RippleModule } from 'primeng/ripple';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';

type ToggleButtonIconPosition = 'left' | 'right';

Expand All @@ -26,7 +26,7 @@ export const TOGGLEBUTTON_VALUE_ACCESSOR: any = {
pRipple
>
<span *ngIf="onIcon || offIcon" [class]="checked ? this.onIcon : this.offIcon" [ngClass]="{ 'p-button-icon': true, 'p-button-icon-left': iconPos === 'left', 'p-button-icon-right': iconPos === 'right' }"></span>
<span class="p-button-label">{{ checked ? (hasOnLabel ? onLabel : '') : hasOffLabel ? offLabel : '' }}</span>
<span class="p-button-label" *ngIf="onLabel || offLabel">{{ checked ? (hasOnLabel ? onLabel : '') : hasOffLabel ? offLabel : '' }}</span>
</div>
`,
providers: [TOGGLEBUTTON_VALUE_ACCESSOR],
Expand Down

0 comments on commit b9cda4b

Please sign in to comment.