Using RequireJS in AngularJS Applications

added by JavaScript Kicks
10/1/2014 12:58:31 PM


While writing large JavaScript applications, one of the simplest things one can do is divide the code base into several files. Doing this improves maintainability of the code but increases the chances of missing or misplacing the script tag on your main HTML document. Keeping track of the dependencies becomes difficult as the number of files increases. This issue persists in large AngularJS applications as well. We have a number of tools in place that take care of loading dependencies in the application. In this article, we will see how to use RequireJS with AngularJS to make the job of loading dependencies simpler. We’ll also examine how to use Grunt to generate combined files containing the RequireJS modules.