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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.