Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does AngularJS find and load modules

Tags:

angularjs

I m trying to understand the sample AngularJS app shipped with Packpub's book. the app.js file is defined under client/src/app folder and it's module definition looks like

angular.module('app', [
  'ngRoute',
  'projectsinfo',
  'dashboard',
  'projects',
  'admin',
  'services.breadcrumbs',
  'services.i18nNotifications',
  'services.httpRequestTracker',
  'security',
  'directives.crud',
  'templates.app',
  'templates.common']);

My question is how AngularJs will find these modules and uses in app?

like image 894
user160820 Avatar asked Oct 20 '22 15:10

user160820


1 Answers

All those modules need to be loaded in your browser as well. AngularJS does not provide a module loader such as RequireJS.

You can either add <script> tags in the index file or concatenate all your sources into one big file. Some of the modules can be from AngularJS (such as the ngRoute). These will always be available in Angular, you do not need to load the sources in separately.

like image 151
thomaux Avatar answered Jan 02 '23 21:01

thomaux