Modules

AngularJS introduces the concept of a module representing components in an application. The module provides a namespace that enables you to reference directives, scopes, and other components based on model name. This makes it easier to package and reuse parts of an application.

Each view or web page in AngularJS has a single module assigned to it via the ng-app directive. (Directives are discussed later in this chapter.) However, you can add other modules to the main module as dependencies, which provides a very structured and componentized application. The main AngularJS module acts similar to the root namespace in C# and Java.

Get Learning AngularJS 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.