June 2014
Intermediate to advanced
696 pages
38h 52m
English
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) {
Read now
Unlock full access