prototypes icon indicating copy to clipboard operation
prototypes copied to clipboard

Object.prototype.forEach() should bind callbacks to the object being iterated

Open compwright opened this issue 8 years ago • 1 comments

This would fix an interop issue with angular.forEach() and Angular.js' FormController:

https://github.com/angular/angular.js/blob/master/src/Angular.js#L292

https://github.com/angular/angular.js/blob/master/src/ng/directive/form.js#L190

Within the callback on line 190, this is undefined if prototypes is installed. Removing the package fixes the issue:

TypeError: Cannot read property '$setValidity' of undefined

This happens if you set up an Angular.js 1.6.x SPA with multiple routes, and set up a form with inputs using ngModel and the required attribute. Within the app, when you browse to another route away from the route containing the form, one of these errors will appear in the console for each form element.

compwright avatar Dec 22 '16 15:12 compwright

Care to send a PR to correct this situation?

alexfernandez avatar Dec 22 '16 16:12 alexfernandez