JavaScript logoJavaScript/
JS-0560

`angular.mock` method can be used directlyJS-0560

Minor severityMinor
Anti-pattern categoryAnti-pattern
angularjs

All methods defined in the angular.mock object are also available in the object window. So you can remove angular.mock from your code

Rule based on Angular 1.x

Bad Practice

// invalid
angular.mock.dump($scope); // error: You should use the "dump" method available in the window object.

// invalid
angular.mock.inject(function (someService) {
    // ...
}); // error: You should use the "inject" method available in the window object.

// invalid
angular.mock.module('myModule'); // error: You should use the "module" method available in the window object.
// valid
dump($scope);

// valid
inject(function (someService) {
    // ...
});

// valid
module('myModule');