June 2014
Intermediate to advanced
696 pages
38h 52m
English
The next step is to define the ng-app parameter in the root element so that AngularJS knows where to begin compiling the application. You should also define the module in your JavaScript code to provide a namespace to use when adding controllers, filters, and services.
Line 2 of Listing 20.2 defines the DOM root for an AngularJS module. Notice that ng-app is assigned the module name firstApp, which corresponds to the module in the JavaScript code:
02 <html ng-app="firstApp">
Line 1 in Listing 20.3 shows the firstApp module object being created in the JavaScript code:
01 var firstApp = angular.module('firstApp', []);
Read now
Unlock full access