Open
Description
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
Labels
No labels