Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.03 KB

angularRequireDependencyOrder.md

File metadata and controls

50 lines (37 loc) · 1.03 KB

angularRequireDependencyOrder

This rule requires that angular dependencies are specified either first or last in a list of dependencies for controllers, directives, factories, services, providers, configurations and resolve objects. Both array and function syntax are supported.

Value: first

Valid function syntax example

angular.module('app').controller('ValidController', function($scope, myService) {
  // ...
})

Valid array syntax example

angular.module('app')
  .controller('ValidController', ['$scope', 'myService', function($scope, myService) {
  // ...
}])

Invalid example

angular.module('app').controller('InvalidController', function(myService, $scope) {
  // ...
})

Value: last

Valid example

angular.module('app').controller('ValidController', function(myService, $scope) {
  // ...
})

Invalid example

angular.module('app').controller('InvalidController', function($scope, myService) {
  // ...
})