Skip to content

[value] resets after updating the options #140

Open
@OlehPetrykUA

Description

@OlehPetrykUA
this.select2Host = [{ id: '', text: text }];
                    if (localStorage.getItem('selectedHost')) {
                        const selectedHost: Select2OptionData = JSON.parse(localStorage.getItem('selectedHost'));
                        this.select2Host.push(selectedHost);
                        this.currentHostIdFromStorage = selectedHost.id;
                    }
<select2
 [value]="currentHostIdFromStorage"
 [data]="select2Host"
</select2>

I take currentHostId from local storage, after that i load all options through the request and selected value becomes the first one

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions