Next, you need to add a controller for HTML elements that you want the AngularJS module to control. You also need to define the controller in your module code.
Line 7 in Listing 20.2 assigns a controller named FirstController
to a <div>
element. This maps the element in the view to a specific controller, which contains a scope:
07 <div ng-controller="FirstController">
Line 2 in Listing 20.3 shows the FirstController
code being added to the firstApp
module:
02 firstApp.controller('FirstController', function($scope) {