You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
@noducks this is kind of "interesting" corner case... The trouble is that you are trying to copy a jQuery / jqLite DOM element treating it like a regular JS object. May I ask what is your use-case here? If you need to clone a jQuery / jqLite element, you should probably use a clone method on en element: a.clone().
I'm not sure if so much more can be done on the AngularJS side as "Illegal invocation" sounds about right to me in this case.
Don't get me wrong: I'm not saying things can't be improved on the AngularJS side, but I would like to understand your use case better before proceeding.
@pkozlowski-opensource - I'm developing an 'educational' flashcard application. I have a queue of cards that get displayed. If the user gets one wrong I show it again after a period of time. I thought a handy way to do this would be to just clone the card (element and all) and throw it on the end of the queue. This had the advantage of keeping scoring data, undo data, etc in one big queue.
Am fairly happy that there are many other ways to implement this. Just happened to notice the error doing it that way, and thought I'd mention it in case it was a bug.
@noducks the primary use-case for those methods is internal stuff within angular --- it's better if you use lodash or jquery or Object.assign instead, typically
@noducks from how it sounds I would presume that you try to do lower-level DOM manipulation from your JS code which is no-no with AngularJS. What you should be rather doing is to copy object model and let AngularJS do the DOM-related stuff. If you stick to manipulating data model angular.copy will work just fine.
Anyway, I'm quite happy with the error you get from AngularJS as it tries to tell you here that something is not right. I'm going to close this issue but I would suggest putting your code in a minimal http://plnkr.co/ and asking at SO or on IRC if you still need help with your use-case.
I think this is probably a bug? Am using 1.3.0beta-16. This code:
causes this error:
whereas if I use underscore.js, it seems to clone the same object without a problem.
The text was updated successfully, but these errors were encountered: