Skip to content

Instantly share code, notes, and snippets.

@ansmith
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ansmith/8960035 to your computer and use it in GitHub Desktop.
Save ansmith/8960035 to your computer and use it in GitHub Desktop.
myApp.controller('MyWidgetControl', function($scope, $controller) {
$controller('AbstractWidgetControl', {$scope: $scope});
//"Public" functions
$scope.myFunction = function() {
//...
};
//Private functions
function myPrivateFn() {
}
});
@grgur
Copy link

grgur commented Feb 20, 2014

to avoid the effects of hoisting, function myPrivateFn() {} should become var myPrivateFn = function () {}

@ansmith
Copy link
Author

ansmith commented Mar 10, 2014

I actually wanted hoisting here. I wanted the private stuff available immediately in case there was any initialization done inline at the top, but I wanted them at the bottom since they're not the key API functions.

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