(c)We Want to Hear from You



Node.js, MongoDB and AngularJS Web Development

First Edition

Copyright © 2014 Pearson Education, Inc.

ISBN-10: 0-321-99578-3

ISBN-13: 978-0-321-99578-0

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an "as is" basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it.

When reviewing corrections, always check the print number of your book. Corrections are made to printed books with each subsequent printing.

First Printing: June 2014

Corrections for November 19, 2014

|Pg |Error – Second Printing |Correction |

|378 thru |Chapter 18, Listing 18.11 |Should read: |

|379 |Reads: | |

| |01 var express = require('express'), |01 var express = require('express'), |

| |02     jade = require('jade'), |02     jade = require('jade'), |

| |03     ejs = require('ejs'); |03     ejs = require('ejs'); |

| |04 var app = express(); |04 var app = express(); |

| |05 app.set('views', './views'); |05 app.set('views', './views'); |

| |06 app.set('view engine', 'jade'); |06 app.set('view engine', 'jade'); |

| |07 app.engine('jade', jade.__express); |07 app.engine('jade', jade.__express); |

| |08 app.engine('html', ejs.renderFile); |08 app.engine('html', ejs.renderFile); |

| |09 app.listen(80); |09 app.listen(80); |

| |10 app.locals({ |10 app.locals.uname = "Brad"; |

| |11   uname : 'Brad', |11 app.locals.vehicle = "Jeep"; |

| |12   vehicle: "Jeep", |12 app.locals.terrain = "Mountains"; |

| |13   terrain: "Mountains", |13 app.locals.climate = "Desert"; |

| |14   climate: "Desert", |14 app.locals.location = "Unknown"; |

| |15   location: "Unknown" |15 app.get('/jade', function (req, res) { |

| |16 }); |16   res.render('user_jade'); |

| |17 app.get('/jade', function (req, res) { |17 }); |

| |18   res.render('user_jade'); |18 app.get('/ejs', function (req, res) { |

| |19 }); |19   app.render('user_ejs.html', function(err, renderedData){ |

| |20 app.get('/ejs', function (req, res) { |20     res.send(renderedData);     |

| |21   app.render('user_ejs.html', function(err, renderedData){ |21   }); |

| |22     res.send(renderedData);     |22 }); |

| |23   }); | |

| |24 }); | |

Corrections for November 17, 2014

|Pg |Error – Second Printing |Correction |

|426 |Chapter 22, Third Paragraph, Second Sentence |Should read: |

| |Reads: | |

| |If you add a property name in a child scope, it does not overwrite the parent but|If you add a property name in a child scope which duplicates a property name in the parent scope, it |

| |creates a property of the same name in the child scope that has a different value|does not overwrite the parent but creates a property of the same name in the child scope that has a |

| |from the parent. |different value from the parent. |

|450 and |Chapter 24, Table 24.2, Directive titles for: |Should read: |

|451 |Reads: | |

| |input.checkbox |input type=”checkbox” |

| |input.email |input type=”email” |

| |input.number |input type=”number” |

| |input.radio |input type=”radio” |

| |input.text |input type=”text” |

| |input.url |input type=”url” |

|458 |Chapter 24, Table 24.4, Description for the follow Directives |Should read: |

| |Reads: | |

| |ngBlur – This directive evaluates an expression when the blur event is triggered.|ngBlur – This directive evaluates an expression when the blur event is triggered due to the element |

| |ngCopy – This directive evaluates an expression when the blur copy is triggered. |losing focus. |

| |ngCut – This directive evaluates an expression when the blur cut is triggered. |ngCopy – This directive evaluates an expression when the copy event is triggered. |

| |ngFocus – This directive evaluates an expression when the blur focus is |ngCut – This directive evaluates an expression when the cut event is triggered. |

| |triggered. |ngFocus – This directive evaluates an expression when the focus event is triggered. |

| |ngMousedown – This directive evaluates an expression when the mouse key is |ngMousedown – This directive evaluates an expression when the mouse button is pressed. |

| |pressed. |ngMouseenter – This directive evaluates an expression when the mouse cursor enters the element. |

| |ngMouseenter – This directive evaluates an expression when the mouse enters the |ngMouseleave – This directive evaluates an expression when the mouse cursor leaves the element. |

| |element. | |

| |ngMouseleave - This directive evaluates an expression when the mouse leaves the | |

| |element. | |

|477 |Chapter 25, Figure 25.1, Replace with new figure |Replace with: |

| | |[pic] |

|479 |Chapter 25, Listing 25.5, Caption |Should read: |

| |Reads: | |

| |service_cookies.js: Implementing an AngularJS controller that interacts with |service_cookie.js: Implementing an AngularJS controller that interacts with browser cookie by using |

| |browser cookies by using the $cookieStore service |the $cookieStore service |

|480 |Chapter 25, Listing 25.6, Caption |Should read: |

| |Reads: | |

| |service_cookies.html: An AngularJS template that implements radio buttons to set |service_cookie.html: An AngularJS template that implements radio buttons to set a cookie value |

| |a cookie value | |

|480 |Chapter 25, Listing 25.6, Line 14 |Should read: |

| |Reads: | |

| |ng-change=”setCookie()”>Frosted |ng-change=”setCookie()”>Frosted |

|480 |Chapter 25, Listing 25.6, Line 17 |Should read: |

| |Reads: | |

| |Cookies: {{myFavCookie}} |Cookie: {{myFavCookie}} |

|480 |Chapter 25, Figure 25.2, Replace Figure |Replace with: |

| | |[pic] |

|504 |Chapter 26, Figure 26.2, Replace Figure |Replace with: |

| | |[pic] |

|520 |Chapter 27, Last Paragraph, First Sentence |Should read: |

| |Reads: | |

| |Notice that when the user accesses the root location for the site, the |Notice that when the user accesses the root location for the site, the photos.html template is |

| |photos.html template is rendered on line 9. |rendered on line 11. |

|521 |Chapter 27, Implementing the Model-Based Controller Routes, First Paragraph, |Should read: |

| |Second Sentence | |

| |Reads: |You break these route handlers out of the standard comments_route.js file and into their own files |

| |You break these route handlers out of the standard comment_route.js file and into|for each model, to keep the code clean and ensure a good division of responsibilities. |

| |their own files for each model, to keep the code clean and ensure a good division| |

| |of responsibilities. | |

|531 |Chapter 27, Listing 27.12, Caption |Should read: |

| |Reads: | |

| |comment_thread.html: Implementing the partial comment thread template |comment_thread.html: Implementing the comment thread template |

|531 |Chapter 27, Listing 27.12, Line 6 |Should read: |

| |Reads: | |

| | | |

|532 |Chapter 27, Listing 27.13, Caption |Should read: |

| |Reads: | |

| |comment_thread.html: Implementing the partial comment template |comment.html: Implementing the partial comment template |

|532 |Chapter 27, Listing 27.13, Line 13 |Should read: |

| |Reads: | |

| | | |

|536 |Chapter 27, Second Paragraph, Second Sentence |Should read: |

| |Reads: | |

| |$scope.photo is updated with the data, and $scope.loadComments() is called to |$scope.photo is updated with the data, and $scope.loadComments() is called to load the comments for |

| |load the comments for the new folder. |the new photo. |

|546 |Chapter 28, Add Note Before Defining the Customer, Product, and Orders Models |Note: |

| | |The example in this chapter needs data to be initialized in the database. If you want to follow along|

| | |with the examples, please look at the “Initializing the Application” section at the end of this |

| | |chapter for instructions on how to initialize the data. |

|547 |Chapter 28, Listing 28.1, Caption |Should read: |

| |Reads: | |

| |cart_model.js-AddressSchema: Defining a schema for shipping and billing addresses|cart_model.js-AddressSchema: Defining an address schema for shipping and billing |

|547 |Chapter 28, Defining the Billing Schema, Second Paragraph, Second Sentence |Should read: |

| |Reads: | |

| |You’ll see this in several places in this example, and you’ll see that through |You’ll see this in several places in this example, and you’ll see that throughout the example, that |

| |the example, that the address is accessed by using address[0] to get the first |the address is accessed by using address[0] to get the first item in the array. |

| |item in the array. | |

|547 |Chapter 28, Listing 28.2, Caption |Should read: |

| |Reads: | |

| |cart_model.js-BillingSchema: Defining a schema for billing credit card and |cart_model.js-BillingSchema: Defining a billing schema for credit card information |

| |address | |

|548 |Chapter 28, Defining the Order Schema, Last Sentence of Paragraph |Should read: |

| |Reads: | |

| |Also, the items field is an array of QuantitySchema subdocuments. |Also, the items field is an array of ProductQuantitySchema subdocuments. |

|552 |Chapter 28, Listing 28.9, Line 07 |Should read: |

| |Reads: | |

| |res.json(404,{msg:‘Photo Not Found.’}); |res.json(404,{msg:‘Product Not Found.’}); |

|585 |Chapter 29, Add Note at Bottom of Page |Note: |

| | |The example in this chapter needs data to be initialized in the database. If you want to follow along|

| | |with the examples, please look at the “Initializing the Application” section at the end of this |

| | |chapter for instructions on how to initialize the data. |

|587 |Chapter 29, Implementing Routes to Support the Views, Third Paragraph, First |Should read: |

| |Sentence | |

| |Reads: | |

| |Notice that when the user accesses the root location for the site (/), the |Notice that when the user accesses the root location for the site (/), the rich_ui.html template is |

| |rich_ui.html template is rendered on line 11. |rendered on line 10. |

|590 |Chapter 29, Implementing the AngularJS Custom Directives, Second Paragraph, Last |Should read: |

| |Sentence | |

| |Reads: |Notice that templateUrl points to the rich_tabs.html template defined above. |

| |Notice that tempalteUrl points to the rich_tabs.html template defined above. | |

|599 |Chapter 29, Implementing the Draggable Directive in an AngularJS View, First |Should read: |

| |Sentence | |

| |Reads: | |

| |With the draggable directive defined in the AngularJS Module object, you can |With the richDraggable directive defined in the AngularJS Module object, you can implement it in your|

| |implement it in your views by simply including the rich-draggable directive in |views by simply including the rich-draggable directive in the HTML element definition. |

| |the HTML element definition. | |

Corrections for November 14, 2014

|Pg |Error – Second Printing |Correction |

|307 |Chapter 16, Table 16.2, Top of Page, Second and Third Method Descriptions |Should read: |

| |Reads: | |

| |Sets the operation to findAndRemove, which deletes the first document object in |Sets the operation to findOneAndRemove, which deletes the first document object in the collection |

| |the collection that matches query. |that matches query. |

| |Sets the operation to findAndRemove, which updates the first document in the |Sets the operation to findOneAndUpdate, which updates the first document in the collection that |

| |collection that matches query. The update operation is specified in the update |matches query. The update operation is specified in the update parameter. See Table 14.2 for the |

| |parameter. See Table 14.2 for the update operators that can be used. |update operators that can be used. |

|313 |Chapter 16, Listing 16.3, Line 28 |Should read: |

| |Reads: | |

| |console.log(“\nWords with even lengths and longer than 5 letters: “); |console.log(“\nWords with even lengths and longer than 6 letters: “); |

|313 |Chapter 16, Figure 16.3 |Replace with: |

| |Replace with new Figure 16.3 |[pic] |

|318 |Chapter 16, Listing 16.6, Lines 09 and 17 |Should read: |

| |Read: | |

| |console.log(doc.toString()); |console.log(doc.toJSON()); |

|370 |Chapter 18, Listing 18.5 Caption |Should read: |

| |Reads: | |

| |Listing 18.5 express_json.js: Sending JSON and JSONP data in a response from |Listing 18.5 express_send_json.js: Sending JSON and JSONP data in a response from Express |

| |Express | |

|374 |Chapter 18, Listing 18.7, Line 15 |Should read: |

| |Reads: | |

| |res.redirect(“../B”); |res.redirect(“/level/B”); |

|375 |Chapter 18, Adding Locals, Last Sentence |Remove Sentence |

| | |app.locals is actually a function object, which means you can set variables in two different ways. |

|376 |Chapter 18, Second Paragraph with code and Warning |Please remove second paragraph with code and Warning |

|379 |Chapter 18, Figure 18.6 |Replace with: |

| |Replace Jade Template Figure |[pic] |

|429 |Chapter 22, Sixth Paragraph, Last Sentence |Should read: |

| |Reads: | |

| |The child controller in line 27 broadcasts this event via $broadcast (). |The child controller in line 27 sends this event via $emit(). |

|439 |Chapter 23, Table 23.1, Filter dated [ : format] |Insert after yy: Two-digit year since 2000: |

| |Add the following Formats under Description |y: Year without padding |

| | |Insert as after M: Month in year, 1-12 |

| | |ww: Weed of year padded 00-53 |

| | |w: Week in year, 0-53 |

|444 |Chapter 23, Second Paragraph, Third Sentence |Should read: |

| |Reads: | |

| |Then in lines 12-29 the controller adds the censorFilter provider, using |Then in lines 12-19 the controller adds the censorFilter provider, using dependency injection. |

| |dependency injection. | |

|449 |Chapter 24, Table 24.1, 4th Directive down |Should read: |

| |Example for ngRequired | |

| |Reads: | |

| | | |

|449 |Chapter 24, Table 24.1, 7th Directive down |Should read: |

| |Example for ngSrcset | |

| |Reads: | |

| | | |

|450 |Chapter 24, Table 24-2, Directive input, 5th and 6th attribute reads: |Should read: |

| |ngMinlenght: Sets the minlength validation error amount. | |

| |ngMaxlenght: Sets the maxlength validation error amount. |ngMinlength: Sets the minlength validation error amount. |

| | |ngMaxlength: Sets the maxlength validation error amount. |

Corrections for November 14, 2014 - Corrections from Errata dated 10/27/2014

|Pg |Error – Second Printing- |Correction |

|259 |Chapter 14, Before Listing 14.3, Add Note |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing 14.1 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|261 |Chapter 14, Listing 14.4, Add Note Before Listing |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing 14.1 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|262 |Chapter 14, Listing 14.5, Add Note Before Listing |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing14.1 first to reset the data that may|

| | |have changed by running other exercises in this chapter. |

|263 |Chapter 14, Listing 14.6, Add Note Before Listing |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing 14.1 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|265 |Chapter 14, , Listing 14.7, Add Note Before Listing |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing 14.1 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|267 |Chapter 14, , Listing 14.8, Add Note Before Listing |Add Note: |

| |Corrections from Errata dated 10/27/2014 |To run the code in this exercise, please run the code in Listing 14.1 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

Corrections for October 27, 2014

|Pg |Error – Second Printing |Correction |

|116 |Chapter 6, Third Paragraph Code |Should read: |

| |Reads: |fs.rmdir("./data/folderA/folderB/folderD", function(err){ |

| |fs.rmdir("./data/folderA/folderB/folderC", function(err){ |  fs.rmdir("./data/folderA/folderB", function(err){ |

| |  fs.rmdir("./data/folderA/folderB", function(err){ |    fs.rmdir("./data/folderA/folderC/folderE", function(err){ |

| |    fs.rmdir("./data/folderD", function(err){ |      fs.rmdir("./data/folderA/folderC", function(err){ |

| |});           |        fs.rmdir("./data/folderA", function(err){           |

| |  }); |        });           |

| |  fs.rmdir("./data/folderA/folderC", function(err){ |      }); |

| |        fs.rmdir("./data/folderE", function(err){           |    });  |

| |        });           |  }); |

| |     });  |}); |

| | }); | |

|124 |Chapter 7, Table 7-2, Description for headers |Should read: |

| |Reads: | |

| |An object that contains request headers. For example: |An object that contains request headers. For example: |

| |{ content – length’:‘750’,‘content-type’: text/plain’}s |{ content – length’:‘750’,‘content-type’:‘text/plain’} |

|125 |Chapter 7, Table 7.4, Description for setTimeout (timeout, [callback]) |Should read: |

| |Reads: | |

| |Sets the socket timeout for the request. |Sets the timeout for the request, in miliseconds, along with an optional callback function to be |

| | |executed if the timeout occurs. |

|127 |Chapter 7, Table 7.7, Caption |Should read: |

| |Reads: | |

| |Events, properties, and methods available on ServerResponse objects |Events, properties, and methods available on ImcomingMessage objects |

|128 |Chapter 7, Table 7.8, Examples for each Event |Should read: |

|Thru |Reads: | |

|129 |function callback |function |

|130 |Chapter 7, Serving Static Files, Third Paragraph, First Sentence |Should read: |

| |Reads: | |

| |Inside the request event handler on line 6, url.pars() method parses the URL so |Inside the request event handler on line 6, url.parse() method parses the URL so that you can use the|

| |that you can use the pathname attribute when specifying the path for the file in |pathname attribute when specifying the path for the file in line 7. |

| |line 7. | |

|158 |Chapter 8, Last Command Listed |Should read: |

| |Reads: | |

| |var options = { |var options = { |

| |  hostname: 'encrypted.', |  host: 'encrypted.', |

| |  port: 8108, |  port: 8108, |

| |  path: '/', | |

| |  method: 'GET' | |

|171 |Chapter 9, Listing 9.2 Caption |Should read: |

| |Reads: | |

| |child_exec.js: Executing a system command in another process |child_process_exec.js: Executing a system command in another process |

|174 |Chapter 9, Listing 9.4, Caption |Should read: |

| |Reads: | |

| |child_process_spawn_file.js: Spawning a command in another process |child_process_spawn.js: Spawning a command in another process |

|181 |Chapter 9, Implementing an HTTP Cluster, Add Note after Third Paragraph |Add Note: |

| | |To execute the files shown in Listings 9.7, 9.8 and 9.9, first execute the cluser_server.js file as a|

| | |node application and then execute the cluster_client.js file as a node application. The |

| | |cluster_worker.js file is executed in the background by the cluster_server.js file. |

|207 |Chapter 12, Installing MongoDB, Add Note After First Paragraph |Add Note: |

| | |The examples in the book are based on MongoDB version 2.4. You should install that version when |

| | |working with these examples. |

|234 |Chapter 13, Listing 13.2, Second Line |Should read: |

| |Reads: | |

| |MongoClinet.connect(mongodb://dbadmin:test@localhost:27017/testDB”, { |MongoClinet.connect(mongodb://dbadmin:test@localhost:27017”, { |

|255 |Chapter 14, Listing 14.1, Caption |Should read: |

| |Reads: | |

| |doc_insert.js: Inserting documents into a collection |doc_add.js: Inserting documents into a collection |

|259 |Chapter 14, Before Listing 14.3, Add Note |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|261 |Chapter 14, Listing 14.4, Add Note Before Listing |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|261 |Chapter 14, Listing 14.4, Line 10 |Should read: |

| |Reads: | |

| |{$set: {type: “Super Nova”, “updated”:true}}, |{$set: {type: “Super Nova”, updated:true}}, |

|262 |Chapter 14, Listing 14.5, Add Note Before Listing |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|263 |Chapter 14, Listing 14.6, Add Note Before Listing |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|265 |Chapter 14, , Listing 14.7, Add Note Before Listing |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

|267 |Chapter 14, , Listing 14.8, Add Note Before Listing |Add Note: |

| | |To run the code in this exercise, please run the code in exercise 14.2 first to reset the data that |

| | |may have changed by running other exercises in this chapter. |

Corrections for October 17, 2014

|Pg |Error – Second Printing |Correction |

|100 |Chapter 6, Listing 6.1, Line 09 |Should read: |

| |Reads: | |

| |09 fs.writeFile(‘config.txt’, configTxt, options, function(err){ |09 fs.writeFile(‘../data/config.txt’, configTxt, options, function(err){ |

|101 |Chapter 6, Listing 6.2, Line 3 |Should read: |

| |Reads: | |

| |3 fd = fs.openSync(‘veggie.txt’, ‘w’); |3 fd = fs.openSync(‘.../data/veggie.txt’, ‘w’); |

|103 |Chapter 6, Listing 6.3, Line 18 |Should read: |

| |Reads: | |

| |18 fs.open(‘fruit.txt’, ‘w’, function(err, fd){ |18 fs.open(‘../data/fruit.txt’, ‘w’, function(err, fd){ |

|104 |Chapter 6, Listing 6.4, Line 04 |Should read: |

| |Reads: | |

| |04 var flieWriteStream = fs.createWriteStream(“grains.txt”, options); |04 var flieWriteStream = fs.createWriteStream(“../data/grains.txt”, options); |

|106 |Chapter 6, Listing 6.5, Line 03 |Should read: |

| |Reads: | |

| |03 fs.readFile(‘config.txt’, options, function(err, data){ |03 fs.readFile(‘../data/config.txt’, options, function(err, data){ |

|107 |Chapter 6, Listing 6.6, Line 02 |Should read: |

| |Reads: | |

| |02 fd = fs.openSync(‘veggie.txt’, ‘r’); |02 fd = fs.openSync(‘../data/veggie.txt’, ‘r’); |

|108 |Chapter 6, Listing 6.7, Line 16 |Should read: |

| |Reads: | |

| |16 fs.open(‘fruit.txt’, ‘r’, function(err, fd){ |16 fs.open(‘../data/fruit.txt’, ‘r’, function(err, fd){ |

|110 |Chapter 6, Listing 6.8, Line 03 |Should read: |

| |Reads: | |

| |03 var fileReadStream = fs.createReadStream(“grains.txt”, options); |03 var fileReadStream = fs.createReadStream(“../data/grains.txt”, options); |

|111 |Chapter 6, Getting File Info, Second Paragraph, First and Second Sentence |Should read: |

| |Reads: | |

| |The fsStatsSync()method returns a Stats object. The fs.stats()method is executed,|The fsStatSync()method returns a Stats object. The fs.stat()method is executed, and the Stats object |

| |and the Stats object is passed to the callback function as the second parameter. |is passed to the callback function as the second parameter. |

|112 |Chapter 6, First Paragraph |Should read: |

| |Reads: | |

| |The code in Listing 6.9 illustrates the use of the fs.stats() call by making the |The code in Listing 6.9 illustrates the use of the fs.stat() call by making the call, then outputting|

| |call, then outputting the results of the object as a JSON string and using the |the results of the object as a JSON string and using the isFile(), isDirector(), and isSocket() |

| |isFile(), isDirector(), and isSocket() calls, as shown in the output in Figure |calls, as shown in the output in Figure 6.9. |

| |6.9. | |

Corrections for October 15, 2014

|Pg |Error – Second Printing |Correction |

|79 |Chapter 5, Copying Buffers, Second Sentence |Should read: |

| |Reads: | |

| |Node.js provides the copy (targetBuffer, [targetStart], [sourceStart], |Node.js provides the copy (targetBuffer, [targetStart], [sourceStart], [sourceEnd]) function for |

| |[sourceIndex]) function for Buffer objects. |Buffer objects. |

|89 |Chapter 5, Third Paragraph, Last Sentence |Sentence to add: |

| |Reads: | |

| |This is because both were pushed to Readable before the data event was triggered.|This is because both were pushed to Readable before the data event was triggered and printed the |

| | |“read: I think, therefore” line to the console output. |

|106 |Chapter 6, Figure 6.5 caption |Should read: |

| |Reads: | |

| |Figure 6.5 Output of file_write.js, reading a configuration file to an object. |Figure 6.5 Output of file_read.js, reading a configuration file to an object. |

Corrections for October 9, 2014

|Pg |Error – Second Printing |Correction |

|77 |Chapter 5, Figure 5.1 Caption |Should read: |

| |Reads: | |

| |Figure 5.1 Output of buffer_copy.js, writing data to a Buffer object. |Figure 5.1 Output of buffer_write.js, writing data to a Buffer object. |

|111 |Chapter 6, Getting File Info, first two calls |Should read: |

| |Reads: | |

| |fs.stats(path, callback) |fs.stat(path, callback) |

| |fs.statsSync (path) |fs.statSync(path) |

Corrections for July 28, 2014

|Pg |Error |Correction |

|17 |Chapter 2, First Bullet, Object Literal command |Should read: |

| |Reads: | |

| |var obj = {“name”: “Brad”, “occupation”: “Hacker”, “age”, “Unknown”}; |var obj = {“name”: “Brad”, “occupation”: “Hacker”, “age”: “Unknown”}; |

Corrections for July 23, 2014

|Pg |Error |Correction |

|34 |Chapter 2, Combining Arrays, First and Second Sentence |Should read: |

| |Reads: | |

| |You can combine arrays the same way that you combine String objects: using + |You can combine arrays using the concat() method but not the + method. In the following code, the |

| |statements or using eh concat () method. In the following code, arr3 ends up |variable arr3 contains a string representation of the elements in arr1 and arr2. Whereas the variable|

| |being the same as arr4: |arr4, in the following code, is an array with the combined elements from arr1 and arr2: |

Corrections for July 21, 2014

|Pg |Error |Correction |

|417 |Chapter 21, First Paragraph, Second Sentence |Should read: |

| |Reads: | |

| |Line 2 and 7 add the value providers. |Line 2 and 8 add the value providers. |

|417 |Chapter 21, First Paragraph, Third Sentence |Should read: |

| |Reads: | |

| |Lines 3 and 8 use dependency injection to inject the value providers into the |Lines 3 and 9 use dependency injection to inject the value providers into the controllers for each |

| |controllers for each module. |module. |

|488 |Chapter 25, Top of Page, First Non-complete Paragraph, last Code Example |Should read: |

| |Reads: | |

| |return function (value) { return value*myConst; }; |return function(value { return value +myConstant; }; |

|488 |Chapter 25, Creating Service Services, Second Paragraph, Last Code Example |Should read: |

| |Reads: | |

| |app.service (‘constMath’, [‘myConst’, ConstMathObj); |app.service (‘constMath’, [‘myConst’, ConstMathObj] ); |

This errata sheet is intended to provide updated technical information. Spelling and grammar misprints are updated during the reprint process, but are not listed on this errata sheet.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download