Created
January 8, 2014 14:08
-
-
Save georgeh/8317224 to your computer and use it in GitHub Desktop.
Angular dependency injection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now that I have done some learning this helps me a lot thank you.