maji1967 (2) [Avatar] Offline
Note: I apologize for the code formatting. It was formatted correctly when I entered it, but the posted message did not preserve the code formatting

I have some comments on the the Hello Angular example in the first chapter. It is more complicated than it needs to be. I prefer the way AngularJS Succinctly gets started. It builds from a simpler example, one step at a time. It starts with a simple example:

<script src=" angularjs/1.0.4/angular.js"> </script>
<body ng-app>

This is your first angular expression: {{ 1 + 2 }}


There is less to explain here than in the Hello Angular example from the MEAP. This is all you need for a minimum angular application: include the angularjs script and use ng-app.

Then introduce controllers with a slightly larger example:

---- HTML file ----
<script src=""></script>
<script src="app.js"></script>
<body ng-app>
<div ng-controller="HelloCtrl">

{{greeting}} {{person}}


---- app.js file ----
// Defines hello world controller.
// $scope special argument to pass data to views.
function HelloCtrl($scope)
$scope.greeting = 'Hello';
$scope.person = 'World';

This kind of approach keeps things simple by introducing and explaining one concept at a time. The Hello Angular example in the MEAP introduced more concepts but did not clearly explain them, like ng-model and angular.model.
mmcconnell (8) [Avatar] Offline
I agree. The hello world example in the first chapter is poorly put together. You should not show a "code snippet" for your first example. The body section in chapter 1. You should show the full html with the especially the script src for angular. Which I didn't know and had to google a example off the angular website.