if (id) {
if (this.entrylist.length) {
this.selected = this.entrylist.filter(e => e.id === id)[0];
- } else {
+ }
+
+ if (!this.selected) {
+ // It's possible the selected ID lives in a set of entries
+ // that are yet to be provided.
this.startId = id;
}
}
}
+
get selectedId(): any {
return this.selected ? this.selected.id : null;
}
@Input() set entries(el: ComboboxEntry[]) {
if (el) {
this.entrylist = el;
+
+ // new set of entries essentially means a new instance. reset.
+ this.defaultSelectionApplied = false;
this.applySelection();
// It's possible to provide an entrylist at load time, but
if (this.startId &&
this.entrylist && !this.defaultSelectionApplied) {
- console.log('applyg select ' + this.startId);
-
const entry =
this.entrylist.filter(e => e.id === this.startId)[0];