Created
January 6, 2015 18:32
-
-
Save jesusr/df54614d384698c4622d to your computer and use it in GitHub Desktop.
Angular.js module declaration with exception alert catched
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
/** | |
* Module | |
*/ | |
var module; | |
try { | |
module = angular.module(moduleName); | |
} catch(err) { | |
// named module does not exist, so create one | |
module = angular.module(moduleName, []); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment