By default, the AngularJS injector service will match the names of the arguments of your controller function against the names of built-in AngularJS services (starting with $ sign):
// Old way to define your controller
angular.module('yourModule')
.controller('yourController', function($scope, $http, yourService){
// Your code here
});
However, since this is simply based on string comparison, this can cause problems when your code is uglified and/or minified.
Therefore it is recommended that you use the newer syntax for creating controllers using the array notation like this:
// Newer, better way to define your controller
angular.module('yourModule')
.controller('yourController', ['$scope', '$http', 'yourService', function($scope, $http, yourService){
// Your code here
}]);
Notice that the controller function is replaced by an array consisting of the services you would like to inject and ending with the controller function.
AngularJS will now inject the services in the order you specified them in the array like this:
['yourService', 'yourOtherService', function(yourService, yourOtherService){
// You can use yourService and yourOtherService here
}]
The names don't have to correspond, so you can use:
['$http', '$scope', function(h, s){
// You can use h and s here
// h will be the $http service, s will be the $scope
}]
It's highly recommended to use the newer array notation because it guarantees that your code will still work after minifying or uglifying it.
Hope that helps!