Chapter 2Modules, Controllers & Data Binding

Structuring your code is the key to writing maintainable software. The good news is that with AngularJS you can easily divide your front-end source code into reusable components, called modules. An AngularJS module is basically a container that groups together different components of your application under a common name. If you look at the Angular Seed project that we downloaded in Chapter 1, you can see that there are different modules defined in the files controllers.js, directives.js, filters.js , services.js, etc. In our main JavaScript file, app.js, we have a module myApp which depends on the above modules (yes, modules can depend on other modules). Finally, in the HTML we tell AngularJS to start ...

Get AngularJS: Novice to Ninja now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.