Skip to content

ReactiveForms default value is not set properly #43

@alusev

Description

@alusev

Component:

    form: FormGroup;
    items  = [ { id: 1, text: 'Apples' }, { id: 2, text: 'Oranges' } ];

    constructor(
        private formBuilder: FormBuilder
    ) { }

    ngOnInit() {
       this.form = this.formBuilder.group({
             item_id: [1]
       });
    }

HTML:

<StackLayout class="nt-form" [formGroup]="form">
    <PickerField  [items]="items" textField="text" valueField="id" pickerTitle="Picker Title" formControlName="item_id">
        <ng-template let-item="item">
            <Label [text]="item.text" class="label"></Label>
        </ng-template>
    </PickerField>
</StackLayout>

Result:
Screen Shot 2020-01-07 at 18 51 09

Expected:
The display value should be Apples instead of 1.

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