ngx-sortablejs icon indicating copy to clipboard operation
ngx-sortablejs copied to clipboard

ERROR TypeError: Cannot read property 'option' of undefined at ngx-sortablejs.js:203

Open liwei511 opened this issue 6 years ago • 9 comments

Cannot read property 'option' of undefined

liwei511 avatar Aug 16 '19 02:08 liwei511

this.sortableInstance is undefined。 what is sortableInstance?

liwei511 avatar Aug 16 '19 02:08 liwei511

I ran into this issue using an older build of angular-sortablejs. The error seems to be related to a new minor release of sortablejs 1.10.0. In my case, downgrading to sortablejs 1.7.0 fixed it.

"angular-sortablejs": "^2.7.0",
"sortablejs": "~1.7.0",

dvose avatar Sep 20 '19 13:09 dvose

I am getting the same error in 3.1.4

codekrafter avatar Jun 13 '20 20:06 codekrafter

I am also seeing this in 3.14 with sortablejs version 1.10.0. It looks like the ngOnChanges method is firing before the create method resolves and creates the sortableInstance.

Everything is working fine after the error, it's just an initial issue. Should be fixable in the package by updating the ngOnChanges function to only execute the option change when the instance exists: image

However, I don't have an alternative for the consumer side, so the console gets filled with this error on load.

blackbaud-conorwright avatar Jul 10 '20 16:07 blackbaud-conorwright

I made a quick PR to hopefully help with resolving this ^

blackbaud-conorwright avatar Jul 15 '20 14:07 blackbaud-conorwright

I would really appreciate it if this got fixed sooner rather than later.

dylanhouston7 avatar Jul 15 '20 15:07 dylanhouston7

@blackbaud-conorwright I don't see anywhere that the sortableInstance is defined in order to check against it from within my component.

TheGameKnave avatar Jul 16 '21 22:07 TheGameKnave

Issue still exist in 11.1.0 version, do you find a way to solve it?

dmmishchenko avatar Apr 05 '23 11:04 dmmishchenko