-
Notifications
You must be signed in to change notification settings - Fork 568
Calling destroy throws exception #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@floydqwz: That snippet is required to avoid memory/dom leaks when an element is no longer available. I think I instantiate the draggable only if the data-drag set to true so while destroying the non instantiated draggable throwing that error. Can we check if the draggable is instantiated for the element and then only destroy it? If yes, would you mind sending a PR? |
On my example page I have four elements with data-drag set to true. I get destroy for all of them but the call fails anyway. So I think it's either 1) The wrong method being invoked. Is is 'destroy'? or 2) Is it too late to call destroy at the point where '$destroy' is called? |
The method is right. Can you share a demo for me look at? On Thu, Jun 26, 2014 at 5:21 PM, floydqwz [email protected] wrote:
With RegardsAmit Gharat The luckiest person is one whose passion and profession are the same. * |
Tried to create one: http://plnkr.co/edit/A7jRstyPg6LjYGMwld0Y?p=preview |
I can confirm this issue w/ AngularJS v1.3.0-beta14 as well. In AngularJS v1.2.19 when the With AngularJS v1.3.0-beta14 when the |
I think I got the plunkr that @floydqwz started working and demonstrating the issue: In my case I was able work around the issue by including jQuery, jQueryUI, and then AngularJS. I suspect that there's a deeper issue that we need to look into so that it can be fixed or at least ensure that it's given the proper attention in the appropriate documentation. |
The "solution" mentioned by @KylePDavis worked for my too. Thanks!! |
the fix from @KylePDavis worked for me during testing, but in a production build where jquery, jqueryui and angularjs are all concatenated and minified together, it no longer works (even though the order is the same). |
I'm having the same problem as @dgrad since my production build minifies and includes everything. Hence I have to decouple my production build and require jquery, jquery-ui, angular from cnd source to force it to work. Any official fix on this? |
Duplicate of #117 |
- Closes #125, #121, #99 - Fix paradox of choice ($ vs jQuery) - Closes #122 - Update jQueryUI depedency in demos and tests - Closes #130 - Restore display value if set, else use block - Closes #128, #36, #30 - Restore zIndex value always - Closes #117, #110 - Fix destroying widgets prior to initialization - Closes #111 - Allow dropping without ngModel similar to dragging
The following code in the jqyouiDraggable directive throws an exception:
element.on('$destroy', function() {
element.draggable('destroy');
});
The exception thrown:
Error: cannot call methods on draggable prior to initialization; attempted to call method 'destroy'
Removing the block of code above solves the problem for me.
The text was updated successfully, but these errors were encountered: