Skip to content

Using c-form-check in ReactiveFormsModule will not display default value for the checkbox #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bernik1980 opened this issue Apr 11, 2025 · 2 comments

Comments

@bernik1980
Copy link

bernik1980 commented Apr 11, 2025

I have a simple form element:

<c-form-check [switch]="true">

And a corresponding form definition:

form = new FormGroup({
isVisible: new FormControl(true)
})

The checked state is not represented for the checkbox. Only until I remove the "cFormCheckInput", which will result in the default checkbox being displayed, but the checkbox beeing checked.

It is the same if changing the value of the form control with
this.form.get('isVisible')!.setValue(true)

It did still work in 5.2.16 (which was the intial @coreui/angular-pro version I used) and got broken somwhere until 5.4.5, which i have no in use.

Additional info:
This seems only to happen, if the form is initially not visible. I had the control inside a c-tabs, which would only be visible after an initial web-call. If I remove the *ngIf, the control would work as expected.

@xidedix
Copy link
Member

xidedix commented Apr 11, 2025

@xidedix
Copy link
Member

xidedix commented Apr 15, 2025

@bernik1980 fixed in @coreui/angular version ~5.4.8

@xidedix xidedix closed this as completed Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants