Skip to content

Error: Invalid boolean when using switch component in angular reactive forms. #1745

Open
@tsonevn

Description

@tsonevn

From @TomaNikolov on February 20, 2019 9:13

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.2.0
  • Cross-platform modules: 5.2.0
  • Android Runtime: 5.2.0
  • iOS Runtime: 5.2.0
  • Plugin(s):

Describe the bug
Using switch component in angular reactive forms causes Invalid boolean error.
This is only reproducible on iOS.

To Reproduce

    profileForm = new FormGroup({
        firstName: new FormControl(''),
        lastName: new FormControl(''),
        pass: new FormControl(''),
    });
<GridLayout>
    <StackLayout [formGroup]="profileForm" class="page">
        <Label text="pass" textWrap="false"></Label>
        <Switch checked="false" formControlName="pass"></Switch>
        <Label text="firstName" textWrap="false"></Label>
        <TextField text="" hint="" secure="false" autocorrect="false"
            formControlName="firstName"></TextField>
        <Label text="lastName" textWrap="false"></Label>
        <TextField text="" hint="" secure="false" autocorrect="false"
            keyboardType="number" formControlName="lastName"></TextField>
    </StackLayout>
</GridLayout>

Sample project

Playground

Copied from original issue: NativeScript/NativeScript#6934

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions