Skip to content

Commit

Permalink
fix: resolve NG0100 runtime error caused by initial readonly state (#…
Browse files Browse the repository at this point in the history
…2986)

Signed-off-by: Akshat Patel <[email protected]>
  • Loading branch information
Akshat55 authored Sep 3, 2024
1 parent 25fff55 commit 070bf4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/input/password-input-label.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class PasswordInputLabelComponent extends BaseIconButton implements After
@HostBinding("class.cds--password-input-wrapper") passwordInputWrapper = true;
@HostBinding("class.cds--text-input-wrapper") textInputWrapper = true;
@HostBinding("class.cds--text-input-wrapper--readonly") get isReadonly() {
return this.wrapper?.nativeElement.querySelector("input")?.readOnly;
return this.wrapper?.nativeElement.querySelector("input")?.readOnly ?? false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/input/text-input-label.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class TextInputLabelComponent implements AfterViewInit {
@HostBinding("class.cds--form-item") labelClass = true;

@HostBinding("class.cds--text-input-wrapper--readonly") get isReadonly() {
return this.wrapper?.nativeElement.querySelector("input")?.readOnly;
return this.wrapper?.nativeElement.querySelector("input")?.readOnly ?? false;
}

/**
Expand Down

1 comment on commit 070bf4d

@marboss
Copy link

@marboss marboss commented on 070bf4d Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice!

Please sign in to comment.