Skip to content

Latest commit

 

History

History
36 lines (20 loc) · 1.06 KB

document-service.md

File metadata and controls

36 lines (20 loc) · 1.06 KB

document-service - use $document instead of document

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

Rule based on Angular 1.x

Styleguide Reference

Examples

The following patterns are considered problems;

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

// invalid
document.title // error: You should use the $document service instead of the default document object

The following patterns are not considered problems;

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

// valid
$document[0].title = ""

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links