Skip to content

Instantly share code, notes, and snippets.

@Enome
Created August 9, 2013 15:47
Show Gist options
  • Save Enome/6194699 to your computer and use it in GitHub Desktop.
Save Enome/6194699 to your computer and use it in GitHub Desktop.

enome-components/some-component

var mod = window.angular.module('some-module', []);
module.exports = 'some-module'; //Export the name as a string.

Main app

var mod = window.angular.module('my-app', [ require('some-component') ]);

Since you export the name of your angular module you can now 'fake' require the module into your main angular.js app. Means you don't have to remember the name of the both the component and the angular module.

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