-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Angular have problems with Object.prototype #10469
Comments
1.3.0-rc.1 is ancient, numerous similar bugs have since been fixed. Please try with 1.3.6 and report back =) |
Well updated the original issue, the bug still persists. |
okay, we're releasing today and there was one more fix for this that landed recently (I think it landed anyway...), so you might want to try 1.3.7 in a few hours --- in the mean time, please provide a minimal reproduction of your bug with v1.3.6 |
Took original plunker from AngularJS - form added 1 line (14.) and error exist (edited plunker) |
Okay, so unrelated to filtering --- that doesn't make a lot of sense though. |
I am not sure exactly why this is happening, because all iterations over $error seems to be in |
I saw it is work in progress, I would like to ask how is it going... I can't really do much else |
I am not sure why this is a bug. From what I see you set the native prototype with an enumerable property. This means any object now has the property x and this property can be enumerated. Object.defineProperty(Object.prototype, "x", {enumerable: true}) |
I have updated plunker to 1.4.0-beta.0. http://plnkr.co/edit/ZDKnJJAOsng5dBlPv7s7?p=preview |
Honestly, I don't think it can be expected that code work with enumerable properties on a built in prototype. Especially modifying The easiest fix would be to declare the method in the following way:
|
Well it is a working workaround, but forcing people to use different syntax isn't a really good solution to problem. |
Just to be clear, this is a best practice (see for example here) and not specific to Angular. Extending To a lesser extend the same holds true for |
Allright, I'll redo it, but it should be noted in the docs too. |
The bug stated (and is not yet fixed as of 1.3.6) when upgraded from 1.3.0-rc.0 to 1.3.0-rc.1. Sorry to report this late, but I couldn't figure it out.
The bug is easily reproduced by:
Object.prototype.x = function(){};
I think this is a bug, since prevent the user from using prototypes.
The text was updated successfully, but these errors were encountered: