Skip to content

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

Description

@compwright

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions