Open OlehPetrykUA opened 5 years ago
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
I found this PR https://github.com/NejcZdovc/ng2-select2/pull/134 Can you review it?
I take currentHostId from local storage, after that i load all options through the request and selected value becomes the first one