Skip to content

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

Closed
@bernik1980

Description

@bernik1980

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions