Services and Controllers Syntax


#1

Hello every one. I would like to get some clarification on the syntax of the following service and controller modules.
I am going to use the script from the 'OUTBOX' app broject.

Here is the controller...
app.controller('HomeController', ['$scope','emails', function($scope,emails) {

emails.success(function(data){
$scope.emails= data;
});

}]);
My question is; in the app.controller list of dependencies[] why is it '$scope' and the 'name' listed before and inside the function??? ['$scope','name', function($scope, name)
can some one please explain?

Also i have a similar question regarding services.
in the following example of a service we have $http both inside the dependencies list and inside the function that is also a dependency.
Why is that ?

app.factory('emails', ['$http',function($http) {
return $http.get('url')
.success(function(data){
return data;
})
.error(function(error){
return error;
});
}]);

Thank you for your time! Looking forward to hearing back!

Services #Controllers #additional-courses:web-beginner-en-40luq #additional-courses:web-beginner-en-ufoal #additional-courses:javascript-advanced-en-2hJ3J