Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 923 Bytes

foreach.md

File metadata and controls

36 lines (22 loc) · 923 Bytes

foreach - use angular.forEach instead of native Array.prototype.forEach

You should use the angular.forEach method instead of the default JavaScript implementation [].forEach.

Rule based on Angular 1.x

Examples

The following patterns are considered problems;

/*eslint angular/foreach: 2*/

// invalid
someArray.forEach(function (element) {
    // ...
}); // error: You should use the angular.forEach method

The following patterns are not considered problems;

/*eslint angular/foreach: 2*/

// valid
angular.forEach(someArray, function (element) {
    // ...
});

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links