Skip to content

Instantly share code, notes, and snippets.

@simonrobb
Created July 14, 2014 21:20
Show Gist options
  • Save simonrobb/ba264b3c0b8dad9971c5 to your computer and use it in GitHub Desktop.
Save simonrobb/ba264b3c0b8dad9971c5 to your computer and use it in GitHub Desktop.
var myModule;
try {
// try to get a previously created module
myModule = angular.module('myModule');
} catch {
// an error is thrown if it doesn't exist. create it now
myModule = angular.module('myModule', []);
}
// the rest of your code
myModule.controller(function () {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment