AngularJS

Errata for AngularJS

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.


Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted
Printed Page x
United States

"Mathias Matias" should be just "Matias".

Mark Volkmann  Sep 25, 2013 
Printed Page many
United States

A general comment on writing ... I don't think you're allowed to break words across lines without using a hyphen.

Mark Volkmann  Sep 29, 2013 
Printed Page all

Anyone not using google's codeo for the examples in the book MUST realize that an important change in the angularJS library was introduced with angularjs 1.2, so that none of the examples in the first chapter, and quite possibly much of the book will work with a locally hosted current version of the library. A decent explanation of the change can be found at http://stackoverflow.com/questions/19943935/angularjs-scope-difference-1-0-x-vs-1-2-x Readers should thus download https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js

Anonymous  Mar 21, 2015 
PDF Page 6
$scope.remove = function

The last line of the following function is probably best ended with a semicolon (;) $scope.remove = function(index) { $scope.items.splice(index, 1); }

Steve taylor  Sep 03, 2014 
Printed Page 7
figure 1-4

The items in the figure is Pebbles, Paint pots and Prunes in that order but in the code on page 6 and 8 it is Paint pots, Polka dots and Pebbles in that order This is in the printed version second release 2013-06-04

Kjell Isacson  Aug 13, 2013 
Printed Page 14
first example top of the page

This is not a technical mistake but there's a difference between examples in page 13 and 14 that could be avoided. The first example use {{messages.someText}} and the second use {{someText.message}}. That could be a little confusing at first.

Anonymous  Mar 27, 2014 
PDF Page 17
3RD PARAGRAPH

function StartUpController($scope) { $scope.funding = { startingEstimate: 0 }; computeNeeded = function() { $scope.funding.needed = $scope.funding.startingEstimate * 10; }; $scope.$watch('funding.startingEstimate', computeNeeded); } THIS SHOULD BE function StartUpController($scope) { $scope.funding = { startingEstimate: 0 , needed: 0 }; $scope.computeNeeded = function() { $scope.funding.needed = $scope.funding.startingEstimate * 10; }; $scope.$watch('funding.startingEstimate', $scope.computeNeeded); }

Abhishikth  May 22, 2014 
PDF Page 22
2

<button ng-click="insertTom()">Insert</button> Need to be included in the ' ng-controller='StudentListController''

Anonymous  Nov 28, 2013 
Printed Page 24
United States

In $scope.stun method, change 'true' to true (remove single quotes).

Mark Volkmann  Sep 23, 2013 
Printed Page 27
United States

In the first line, the characters "<=" were combined into a single symbol.

Mark Volkmann  Sep 23, 2013 
Printed Page 27
United States

At the end of the first paragraph, "reference arrays and object notation" should be "reference array elements and object properties".

Mark Volkmann  Sep 23, 2013 
Printed Page 27
United States

Near the end of the third paragraph, "view and controllers" should be "views and controllers".

Mark Volkmann  Sep 23, 2013 
Printed Page 27
section "Expressions", paragraph 2, line 4

In the list of bitwise operations, there is a backslash in front of the carat. The list should read "(^, &, |)", with no backslash after the open paren.

Stephen Gildea  Oct 08, 2013 
Printed Page 27
2nd paragraph

In the line: make comparisons (==, !=, >, <, >=, &#8656;), &#8656; of course should have been a <= but I suspect some Auto-Replace in software might have messed this up.

Anonymous  Nov 05, 2013 
Printed Page 35
United States

In the table with columns "Function" and "Defines", factory(name, $getFunction()) should be factory(name, function) and service(name, constructor() should be service(name, constructor) The functions passed to these should not be executed in the calls to factory and service.

Mark Volkmann  Sep 23, 2013 
PDF Page 36
The example code...

Missing a ng-repeat, add <tr ng-repeat = "item in items"> to the code as following... <table> <tr ng-repeat="item in items"> <td>{{item.title}}</td> <td>{{item.description}}</td> <td>{{item.price | currency}}</td> </tr> </table>

Anonymous  Aug 16, 2013 
PDF Page 39 and 40
index.html and controllers.js code examples

index.html is <html ng-app="AMail"> <head> <script src="src/angular.js"></script> <script src="src/controllers.js"></script> </head> <body> <h1>A-Mail</h1> <div ng-view></div> </body> </html> is must be <html ng-app="AMail"> <head> <script src="src/angular.js"></script> <script src="src/angular-route.js"></script> <script src="src/controllers.js"></script> </head> <body> <h1>A-Mail</h1> <div ng-view></div> </body> </html> controller.js module creation is var aMailServices = angular.module('AMail', []); it must be var aMailServices = angular.module('AMail', ["ngRoute"]); this will enable routing for the example

Andre Dublin  Nov 13, 2013 
PDF Page 41
code example

messages = [{ /* code omitted */ }]; should be var messages = [{ /* code omitted */ }];

Andre Dublin  Nov 13, 2013 
PDF Page 41
3rd "fake e-mail" on the variable

On the fake e-mails array below the comment: //fake e-mails how it is: { id: 2, sender: 'bill@somecompany.com', subject: 'Lost python', date: 'Dec 6, 2013 20:35:02', recipients: ['greg@somecompany.com'], message: "Nobody panic, but my pet python is missing from her cage.' +'She doesn't move too fast, so just call me if you see her." }, ]; how it should be: { id: 2, sender: 'bill@somecompany.com', subject: 'Lost python', date: 'Dec 6, 2013 20:35:02', recipients: ['greg@somecompany.com'], message: "Nobody panic, but my pet python is missing from her cage." +"She doesn't move too fast, so just call me if you see her." }, ]; Just quotes / double quotes inconsistency.

Welington Cruz  Dec 03, 2013 
Printed Page 42
HTML Example at bottom of page.

There is a missing <div> after the <body> tag (i.e. there is a </div> before the </body> without a matching <div> after <body>).

Steven Gray  Aug 31, 2013 
PDF Page 43
code block at the botoom

page 43: appModule.directive('ngbkFocus', function() { page 44: <button ngbk-focus ng-click="clickFocused()"> It needs to be ngbkFocus or ngbk-focus.

Anonymous  Nov 02, 2015 
PDF Page 44
controller.js code example

In the controller.js code example the last line reads var appModule = angular.module('app', ['directives']); It should be var appModule = angular.module('app', []); You do not need to pass a dependency to use directives for modules

Andre Dublin  Nov 13, 2013 
PDF Page 44
controller.js

$scope.clickFocused = function { should be: $scope.clickFocused = function() {

Anonymous  Oct 17, 2014 
Printed Page 50
United States

This error was introduced in the third printing. In the fourth paragraph, ") repository)" should be ") repository". In extra paren is present.

Mark Volkmann'  Sep 29, 2013 
Printed Page 53
United States

In the first sentence in the TDD box, "AGILE" should not be all uppercase since it is not an acronym.

Mark Volkmann  Sep 26, 2013 
Printed Page 55
United States

In the first sentence, change "code that could" to "code could" or "code can".

Mark Volkmann  Sep 26, 2013 
PDF Page 69-76
Integrating AngularJS with RequireJS

Yeoman related information is outdated. When you setup a project with yeoman, the vendor libraries are storied in the bower_components folder. It would make sense to use bower for the requirejs libraries as well. E.g. > bower install requirejs --save > bower install requirejs-domready --save and then appropriately update the paths in main.js, index.html, etc.

nonplus  Jul 13, 2013 
Printed Page 78
United States

The page number is from the third printing. In the cookie recipe screenshot I'm pretty sure "chewy on the outside" was meant to be "chewy on the inside". This error appears again in the code on the following page.

Mark Volkmann  Sep 29, 2013 
Printed Page 81
United States

The page number is for the third printing. In the "Services" section, in the second to last paragraph on page 81, change "Of the the" to "Of the".

Mark Volkmann  Sep 29, 2013 
Printed Page 88
1st line of code example (the comment)

In the first line of the code example (a comment), it says that the file is app/scripts/controllers/controllers.js, while it should be app/scripts/app.js

Gabriele Nosso  Nov 12, 2014 
Printed Page 89
United States

The page number is in the third release. In the fifth paragraph, "passed into the constructor" should be "passed into the controller function". I don't think it is considered to be a constructor when written in the style using the module controller method. You might also want to add to the end of this sentence "using dependency injection".

Mark Volkmann  Sep 29, 2013 
Printed Page 89
United States

The page number is in the third release. The section "The Templates" makes use of Twitter Bootstrap which is a great thing. But it never explicitly states that it is doing that. Readers that are unfamiliar with Twitter Bootstrap will likely be confused by this HTML. For example, they won't know what class="span2" means. I don't think the book needs to explain Twitter Bootstrap, just say that this example uses several CSS classes from Twitter Bootstrap.

Mark Volkmann  Sep 29, 2013 
Printed Page 91
United States

The page number is for the third release. In the first line, "works it magic" should be "works its magic".

Mark Volkmann  Sep 29, 2013 
Printed Page 91
United States

The page number is in the third release. In list.html, within the li tag there is no need to wrap the a tag with a div tag.

Mark Volkmann  Sep 29, 2013 
Printed Page 92
3rd paragraph

The text says "The next interesting usage is that of ng-show and ng-class...the <i> tag..." None of these appear in the preceding code or in the github code.

EdHatch  Sep 27, 2013 
Printed Page 92
4th paragraph

The text says "The ng-class is used to add a class to the <h2> tag..." This does not appear in the code above or on github.

EdHatch  Sep 27, 2013 
PDF Page 92
3rd paragraph

The book says "The next interesting usage is that of the ng-show and ng-class to style the template. The ng-show tag has been added to the <i> tag.... The code provided doesn't show this at all and neither did the included code files, its as if the author came back after the fact and made changes to the template and the code doesn't reflect that. There really needs to be better proofing, because this entire book is plagued with mistakes and it makes me feel ripped off and un-trusting as to the validity of the actual content. It seems to be an industry wide problem, because the last 10 book I purchased suffer from the same issues. I don't expect books to be 100% perfect, but come on, this book has errata for nearly every other page!

Joe LoMoglio  Oct 22, 2013 
Printed Page 94
United States

The page number is in the third release. In the second paragraph, "ng-controller tag" should be "ng-controller directive".

Mark Volkmann  Sep 29, 2013 
Printed Page 94
United States

The page number is in the third release. In the fifth paragraph, change "required tag" to "required directive".

Mark Volkmann  Sep 29, 2013 
Printed Page 95
United States

The page number is in the third release. Someone really loves the word "tag"! ;-) I think most people assume that to mean an HTML tag. In the first paragraph, change "$invalid tag" to "$invalid property".

Mark Volkmann  Sep 29, 2013 
Printed Page 96
United States

The page number is in the third release. The first numbered list item says "Creates a globally accessible scope and controller". That is misleading. I looked at the code for a while to figure out where it did that, but it does not do that. This should say "Declares globally accessible scope and controller variables".

Mark Volkmann  Oct 01, 2013 
Printed Page 96
United States

The page number is in the third release. The test suite for ListCtrl declares and sets the variables mockBackend and recipe, but neither is used in the test. Remove those to avoid confusion. Likewise, the suite for MultiRecipeLoader on the next page declares and sets recipe, but doesn't use it.

Mark Volkmann  Oct 01, 2013 
Printed Page 98
United States

The page number is in the third release. In the beforeEach of the EditController suite, the variable ctrl is never used. Can't that line be changed to just "$controller('EditCtrl', {"?

Mark Volkmann  Oct 01, 2013 
Printed Page 98
United States

The page number is in the third release. In the beforeEach of the EditController suite, the variable ctrl is never used. Can't that line be changed to just "$controller('EditCtrl', {"?

Mark Volkmann  Oct 01, 2013 
Printed Page 102
United States

The page number is in the third release. In the POST example at the bottom of the page, lines 2-5 are indented too far.

Mark Volkmann  Oct 01, 2013 
Printed Page 104
United States

The page number is in the third release. The example value for params shows an array containing an object with two properties, key1 and key2. It should be just the object, not an array containing the object.

Mark Volkmann  Oct 01, 2013 
Printed Page 104
United States

The page number is in the third release. In the first numbered bullet under "Setting HTTP Headers", ", /" should be ", */*".

Mark Volkmann  Oct 06, 2013 
PDF Page 108
1

The test was writing for NamesListCtrl controller . Not sure how it ends up at PhoneListCtrl . Or was that something different you were trying to point out ?

Hari K T  Feb 19, 2014 
Printed Page 109
United States

The page number is in the third release. In the third bullet under "The ngResource", "Use inject $resource" should be "Inject $resource".

Mark Volkmann  Oct 01, 2013 
Printed Page 110
United States

The page number is in the third release. The book should explain that CreditCard.delete is just an alias for CreditCard.remove and that remove is easier to use in IE since delete is treated as a keyword in IE. Also, the book should explain that $save, $remove and $delete are instance methods on resource objects that do not require identifying the object to be acted upon, whereas save, remove and delete are like class methods that require you to pass the resource object to them.

Mark Volkmann  Oct 06, 2013 
PDF Page 110
3rd paragraph

Not sur if this is an error or typo myAppModule.factory('CreditCard', ['$resource', function($resource) { return $resource('/user/:userId/card/:cardId', }]); {userId: 123, cardId: '@id'} the @id is explained on page 111 as "tWe say cardId is "@id., but nowhere in the example page 110 (6th line before end) is used on 'id' param, there is a CardId but no id This should be clarified because it is hard to understand

Francois Jacquier  Jun 10, 2014 
Printed Page 112
United States

The page number is in the third release. In the first paragraph, "card's" should be "cards" and it should be monospaced.

Mark Volkmann  Oct 06, 2013 
Printed Page 114
United States

The page number is in the third release. The first bullet is missing a period the end of its last sentence, after "in the UI".

Mark Volkmann  Oct 06, 2013 
Printed Page 120
United States

The page number is in the third release. In the send paragraph, change "namespace-directive" to "namespace-directive-name" to be consist with the first sentence under "Directives and HTML Validation" on the previous page.

Mark Volkmann  Oct 06, 2013 
PDF Page 121
Box titled "When can you use Angular Resources?"

The 4th point looks like it should probably be PUT to update the user 123's credit card nr 15.

Sam Gronblom  Feb 06, 2014 
Printed Page 125
United States

The page number is in the third release. The last paragraph discusses an approach to "concatenate all the templates into a single file", but it doesn't describe how that file is later split back into separate templates. This is not obvious.

Mark Volkmann  Oct 06, 2013 
Printed Page 128
United States

The page number is in the third release. In the second paragraph where it says "receives a transclude function as a property", "property" should be "parameter".

Mark Volkmann  Oct 06, 2013 
Printed Page 128
United States

The page number is in the third release. In the last sentence of the first paragraph under "Scopes", change "Evaluate" to "Scope is also used to evaluate". The sentence doesn't make sense as is.

Mark Volkmann  Oct 06, 2013 
Printed Page 132
United States

The page number is in the third release. In the title of table 6-6, "Angular specific" should be "Angular-specific".

Mark Volkmann  Oct 06, 2013 
Printed Page 144
United States

The page number is in the third release. In the first paragraph where is says "after the injector is finished creating.", I was wondering "When it is finished creating what?". Then I realized you meant "after the injector has been created." I think it is more clear to word it that way.

Mark Volkmann  Oct 06, 2013 
Printed Page 147
United States

The page number is in the third release. In the first full sentence, "parents" should be "ancestors". The word "parent" implies only one level above.

Mark Volkmann  Oct 06, 2013 
Printed Page 150
United States

The page number is in the third release. In the first sentence under "Creating localized rule sets", remove the parentheses. The sentence shouldn't end with just "like".

Mark Volkmann  Oct 06, 2013 
Printed Page 150
United States

The page number is in the third release. At the end of the second paragraph, change "contents of the" to "contents of" or add the word "file" to the end of the sentence.

Mark Volkmann  Oct 06, 2013 
Printed Page 152
United States

The page number is in the third release. The second sentence on the page says "the style tag ... removed". But style is an attribute, not a tag. Change it to "the p tag".

Mark Volkmann  Oct 06, 2013 
Printed Page 152
United States

The page number is in the third release. There are two lines that show this example output: an html _click here_ snippet I believe the underscores are a markup attempt to get "click here" to appear in italics. In the first occurrence, "click here" should not be in italics because the "em" tag will be removed. In the second occurrence, "click here" should be in italics. In both cases, the underscores should be removed.

Mark Volkmann  Oct 06, 2013 
Printed Page 152
United States

The page number is in the third release. In the first sentence in the "Linky" section, "convert links" should be "convert URLs". I don't think people look at a string like "http://angularjs.org/" and think of it as a link. They only think of it as a link when there is an "a" tag present.

Mark Volkmann  Oct 06, 2013 
Printed Page 154
United States

The page number is in the third release. The value given to the require property is '?ngModel', but the command above it says "Always use along with an ng-model". Shouldn't the "?" be removed since specifying ng-model is not optional? Wouldn't that remove the need to check for the presence of ngModel in the link function?

Mark Volkmann  Oct 07, 2013 
Printed Page 154
United States

The page number is in the third release. Earlier I posted an errata for this that asked whether the require property in the directive definition object should start with "?" indicating that it is optional. I tested this. Since this directive requires ngModel to be specified, I think it is much better to remove the "?". That also allows the check for ngModel in the beginning of the link function to be removed. If ng-model is omitted from the input element in the HTML, the error message "No controller: ngModel" will be output which seems appropriate.

Mark Volkmann  Oct 09, 2013 
Printed Page 157
United States

The page number is in the third release. The second paragraph should not be indented.

Mark Volkmann  Oct 07, 2013 
PDF Page 162
In the link function in the fileupload directive code example, following line: "if (scope.done) {"

Parameters "e" and "data" are ommitted on call to optionsObj.done(). Should be specified like it is on the optionsObj.progress() method. if (scope.done) { optionsObj.done = function() { scope.$apply(function() { scope.done({e: e, data: data}); }); }; Should be: if (scope.done) { optionsObj.done = function(e, data) { scope.$apply(function() { scope.done({e: e, data: data}); }); }; directive will crash after succesful upload with "'e' undefined" error unless code updated!

Tommy Bowes  Apr 25, 2014 
Printed Page 162
half way down the page: inside the link: elemnt, the scope.done section is wrong (javascript code)

File upload example does not work properly - in particular, does not call the "done" function properly. Reason: parameter e and data are missing from anonymous function definition. section should read: if( scope.done ) { optionsObj.done = function( e, data ) { // THESE PARAMETERS WERE MISSING ... } Took me about 4 hours javascript debugging to notice this, because I'm not very familiar with Firefox Web Developer tools.. Note that this error is still present in the github repo - I downloaded the example from: https://github.com/shyamseshadri/angularjs-book/blame/master/chapter8/file-upload/directives.js

Duncan White  Apr 27, 2015 
Printed Page 163
United States

The page number is in the third release. I think it is much more common to specify the "lang" attribute on the "html" element than on the "head" attribute. After all, the "body" is also in the same language.

Mark Volkmann  Oct 10, 2013 
Printed Page 164
United States

The page number is in the third release. In the last sentence describing the "done" attribute, "arguments that our directive calls" should be "arguments that our directive passes" since arguments cannot be called.

Mark Volkmann  Oct 10, 2013 
Printed Page 165
United States

The page number is in the third release. In the second to last paragraph, "on event and broadcast event" should be "on event and emit event". The Socket.IO methods being called are "on" and "emit".

Mark Volkmann  Oct 10, 2013 
Printed Page 168
United States

The page number is in the third release. In the second to last paragraph, "The fetch function", strange as it sounds, should be "The fetchFunction function" since that is the actual name of the function.

Mark Volkmann  Oct 10, 2013 
Printed Page 169
United States

The page number is in the third release. I realize you would have more tests that this for real code, but I suggest modifying the test you show so that the number of elements in the "items" array (6) is not a multiple of the page size (3). Removing the 6 from the array and the expected results would make this seem like a more likely scenario.

Mark Volkmann  Oct 10, 2013 
Printed Page 171
United States

The page number is in the third release. At the bottom of the page a service is defined named "errorService". However, in the references to it that follow the name is "ErrorService".

Mark Volkmann  Oct 13, 2013 
Printed Page 172
United States

The page number is in the third release. The "clear" method defined in ErrorService at the top of the page is never called.

Mark Volkmann  Oct 13, 2013 
Printed Page 172
United States

The page number is in the third release. Why is the error message stored in both the ErrorMessage service and in the scope of the alertBar directive? Couldn't the ErrorMessage service be injected into the directive so it could get errorMessage from there instead of storing it again in its own scope?

Mark Volkmann  Oct 13, 2013 
Printed Page 173
United States

The page number is in the third release. In the second paragraph to the end, I think it would be more clear to change "Since this will change every time" to "Since this will be different for each user". The former gives the impression that it changes with each request.

Mark Volkmann  Oct 13, 2013