diff --git a/src/lib/src/service/select.service.ts b/src/lib/src/service/select.service.ts index 2eb2c4d..d3ffda2 100644 --- a/src/lib/src/service/select.service.ts +++ b/src/lib/src/service/select.service.ts @@ -163,21 +163,19 @@ export class SelectService { private getSelectedItems(array: SelectableItem[]): SelectableItem[] { if (this.Configuration.isValid()) { let res: SelectableItem[] = []; - array.forEach(v => { + for (let v of array) { if (v.hasChild && v.selected === true) { - if (this._options.allowMultiple) { if (v.children.every(child => child.selected === false)) { res = [...res, v]; } else { res = [...res, ...this.getSelectedItems(v.children)]; } - } } else if (v.hasChild) { res = [...res, ...this.getSelectedItems(v.children)]; } else if (v.selected === true) { res = [...res, v]; } - }); + }; return res; } else { return [];