angular-ui-tree / angular-ui-tree

A tree component for AngularJS, without jQuery as dependency.
http://angular-ui-tree.github.io/angular-ui-tree
MIT License
2.57k stars 783 forks source link

Getting "Cannot read property '$type' of undefined" error #590

Closed collinlucke closed 8 years ago

collinlucke commented 9 years ago

This maybe a total busch league issue as I'm not that experiences with AngularJS yet, but when I try to apply angular-ui-tree to my set of things I want sortable I get the following error:

"Uncaught TypeError: Cannot read property '$type' of undefined" on line 803 of angular-ui-tree.js

I'm still able to click my handles and drag the nodes around and the placeholder space shows up. They don't reorder, however.

xsintill commented 8 years ago

Sounds like an issue we were having also.
I changed the following line in angular-ui-tree.js in a project we are working with angular-ui-tree outOfBounds = !(targetElm.scope().$type); to outOfBounds = !targetElm.scope() || !(targetElm.scope().$type); This makes sure property $type is not on something undefined.

Voles commented 8 years ago

Fixed by #647. @MalleusMalefic can you confirm?