Skip to content

Instantly share code, notes, and snippets.

@georgeh
Created January 8, 2014 14:08
Show Gist options
  • Save georgeh/8317224 to your computer and use it in GitHub Desktop.
Save georgeh/8317224 to your computer and use it in GitHub Desktop.
Angular dependency injection
angular.module('module')
.factory('myService', function($scope, $http, otherService) {
// ...
});
// is the same as
angular.module('module')
.factory('myService', ['$scope', '$http', 'otherService', function(scopy, ಠ_ಠ, $scope) {
// scopy == Angular's $scope
// ಠ_ಠ == Angular's $http
// most alarmingly, $scope == otherService, which is a downright dirty thing to do to the maintentnece team
}]);
@kalisjoshua
Copy link

Now that I have done some learning this helps me a lot thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment