@@ -79,28 +79,27 @@ the `PhoneListCtrl` __controller__. The __controller__ is simply a constructor f
7979__`app/js/controllers.js`:__
8080<pre>
8181
82- function PhoneListCtrl($scope) {
82+ var phonecatApp = angular.module('phonecatApp', []);
83+
84+ phonecatApp.controller('PhoneListCtrl', function PhoneListCtrl($scope) {
8385 $scope.phones = [
84- {" name": " Nexus S" ,
85- " snippet": " Fast just got faster with Nexus S." },
86- {" name": " Motorola XOOM™ with Wi-Fi" ,
87- " snippet": " The Next, Next Generation tablet." },
88- {" name": " MOTOROLA XOOM™" ,
89- " snippet": " The Next, Next Generation tablet." }
86+ {' name': ' Nexus S' ,
87+ ' snippet': ' Fast just got faster with Nexus S.' },
88+ {' name': ' Motorola XOOM™ with Wi-Fi' ,
89+ ' snippet': ' The Next, Next Generation tablet.' },
90+ {' name': ' MOTOROLA XOOM™' ,
91+ ' snippet': ' The Next, Next Generation tablet.' }
9092 ];
91- }
92-
93- var phonecatApp = angular.module('phonecatApp',[]);
94- phonecatApp.controller('PhoneListCtrl', PhoneListCtrl);
93+ });
9594
9695</pre>
9796
98- Here we have declared a controller called __PhoneListCtrl__ and registered it in an AngularJS
97+ Here we declared a controller called __PhoneListCtrl__ and registered it in an AngularJS
9998module, `phonecatApp`. Notice that our `ng-app` directive (on the `<html>` tag) now specifies the `phonecatApp`
10099module name as the module to load when bootstrapping the Angular application.
101100
102- Although the controller is not yet doing very much controlling , it is playing a crucial role. By
103- providing context for our data model, the controller allows us to establish data-binding between
101+ Although the controller is not yet doing very much, it plays a crucial role. By providing context
102+ for our data model, the controller allows us to establish data-binding between
104103the model and the view. We connected the dots between the presentation, data, and logic components
105104as follows:
106105
0 commit comments