ionic-selectable icon indicating copy to clipboard operation
ionic-selectable copied to clipboard

Undefined properties. Problems with 'selectableComponent' variable

Open Sebastian-Elstadt opened this issue 2 years ago • 1 comments

I am running an Ionic 6 Capacitor(v4.6.2) app. It has "@ionic-selectable/angular": "^5.0.0-alpha.19" installed. The module is imported in my app component and the child component. (I am using the new Angular standalone: true methods for my components.) The ionic-selectable component loads correctly in the ion-item. But once it is opened, the console is bombarded with:

Cannot read properties of undefined (reading 'selectableComponent') Cannot read properties of undefined (reading 'isAddItemTemplateVisible') Cannot read properties of undefined (reading 'shouldFocusSearchbar') Cannot read properties of undefined (reading 'selectableComponent')

The first error seems to stem from a method called connectedCallback, which looks like the following:

const modalElement = document.querySelector('ion-modal'); this.selectableComponent = modalElement.componentProps.selectableComponent; this.selectableComponent.selectableModalComponent = this;

And it looks like componentProps is undefined, causing the error, and keeping selectableComponent null/undefined which crashes other code.

Sebastian-Elstadt avatar Jan 30 '23 12:01 Sebastian-Elstadt

Hi, I am facing the same issue. It works find on the page but not working in the modal. Regards

schagani avatar Mar 08 '23 04:03 schagani