Skip to content

Latest commit

 

History

History
36 lines (20 loc) · 1.05 KB

window-service.md

File metadata and controls

36 lines (20 loc) · 1.05 KB

window-service - use $window instead of window

Instead of the default window object, you should prefer the AngularJS wrapper service $window.

Rule based on Angular 1.x

Styleguide Reference

Examples

The following patterns are considered problems;

/*eslint angular/window-service: 2*/

// invalid
window.alert('Hello world!'); // error: You should use the $window service instead of the default window object

The following patterns are not considered problems;

/*eslint angular/window-service: 2*/

// valid
$window.alert('Hello world!');

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links