Another important point is that the objects of the loaded modules (a, b and c) are subsequently cached and are served when the same modules are required again.
2. Integration of RequireJS with AngularJS
Let’s create a simple AngularJS application to understand a very basic integration with RequireJS.
So we have defined three modules – the main app module (myApp), profession and todo. Within todo module, we have our controller defined. Note that the todo module is dependent on the profession module, basically because we wanted the profession field to be pre-populated before the other details could be filled out. So unless the profession module is loaded, the todo module will not load, and hence the application controller.
Same is the case when we are initializing our AngularJS application using angular.bootstrap. The initialization will happen only when the whole of the document and todo module has loaded successfully, while making sure all the scripts are included in the footer.