Skip to content

Instantly share code, notes, and snippets.

@kadamwhite
Created May 22, 2013 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadamwhite/5627762 to your computer and use it in GitHub Desktop.
Save kadamwhite/5627762 to your computer and use it in GitHub Desktop.
AngularJS Declaration Conventions
module.directive('myDirective', [
'$compile',
'$location',
'Notify',
'sharedData',
function($compile, $location, Notify, sharedData) {
// do stuff
}
);
module.directive('myDirective', [
'$location',
'$compile',
'Notify',
'sharedData',
function($location, $compile, Notify, sharedData) {
// do stuff
}
);
module.directive('myDirective', [
'$compile',
'$location',
'Notify',
'sharedData',
function(
$compile,
$location,
Notify,
sharedData
) {
// do stuff
}
);
module.directive('myDirective', ['$location', '$compile', 'Notify', 'sharedData', function($location, $compile, Notify, sharedData) {
// do stuff
});
module.directive('myDirective', ['$location', '$compile', 'Notify', 'sharedData',
function($location, $compile, Notify, sharedData) {
// do stuff
}
);
@bmac
Copy link

bmac commented May 22, 2013

Yeah when I run sort-lines in my editor the angular modules bubble to the top because of the $ symbol.

@kadamwhite
Copy link
Author

Note that for most controllers this will result in $scope not coming first. This is acceptable.

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