Find an error in the guide? Share it here.
Chapter 18, on page 351, in section Connecting ChatForm to the socket
ChatMessage
should be initialized like so: new ChatMessage({message: data})
Here is the code snippet in the book:
this.chatForm.init((data) => {
let message = new ChatMessage(data);
socket.sendMessage(message.serialize);
});
It should be:
this.chatForm.init((data) => {
let message = new ChatMessage({message: data});
socket.sendMessage(message.serialize);
});
Chapter 18, on page 352 , in the section Creating the ChatList Class
and again on page 355, in the section Using Gravatars
The next to last line in drawMessage
is printed as:
$(this.listId).append($messageRow);
It should be:
this.$list.append($messageRow);
Chapter 18, on page 360, in the section Formatting and Updating Message Timestamps
After adding moment
as a development dependency, make sure to add the line
import moment from 'moment';
to the top of the file dom.js
Chapter 19, on page 381, in the section For the More Curious: npm and Bower Install
The text in the book:
“…and versions to a JSON for each tool. In the case of Bower, the JSON is bower.json
; . . .”
should be
“…and versions to a JSON file for each tool. In the case of Bower, the JSON file is bower.json
; . . .”
In that same section, this JSON snippet:
{
"name": "tracker",
"dependencies": {
"ember": "~2.4.3",
}
}
Should be:
{
"name": "tracker",
"dependencies": {
"ember": "~2.4.3",
"ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
"bootstrap-sass": "^3.3.6"
}
}
Chapter 6, page 126, in the section Adding an Event Listener
There is a missing opening curly brace in the first line of the definition of addthumbnailClickHandler
In the book, it is
function addThumbClickHandler(thumb)
It should be:
function addThumbClickHandler(thumb) {
Chapter 8, page 190, in the section Initializing CoffeeRun on Page Load
The code listing shows extra closing angle brackets for the script
tags:
In the book, it shows these two script
tags:
<script src="scripts/datastore.js" charset="utf-8"></script>>
<script src="scripts/truck.js" charset="utf-8"></script>>
Those should be:
<script src="scripts/datastore.js" charset="utf-8"></script>
<script src="scripts/truck.js" charset="utf-8"></script>
Chapter 10, page 221, in the section Registering createOrder as a submit handler
The third paragraph of that section instructs the reader to update formhandler.js
.
The file that should be changed is main.js
.
Chapter 13, page 270, in the section Using jQuery’s $.ajax method
The last code listing on the page shows a call to remoteDS.getAll()
.
At this point, getAll
expects a callback, and should be invoked like so:
remoteDS.getAll(function (data) { console.log(data); });
Chapter 13, page 272, in the section Replacing DataStore with RemoteDataStore
The following line should not appear in the last two code listings:
var webshim = window.webshim;
This code was part of the For the More Curious: The Webshims Library section on page 255.
Chapter 14, page 285, in the section Using Deferreds with Callback-Only APIs
The final code listing on the page has references to a webshim
object.
These two lines should be ignored.
That listing should be:
...
formHandler.addInputHandler(Validation.isCompanyEmail);
myTruck.printOrders(checkList.addRow.bind(checkList));
})(window);
This code was part of the For the More Curious: The Webshims Library section on page 255.
Chapter 14, page 290, in the section Promise-ifying the other DataStore methods
The final code listing on the page has a reference to a webshim
object. This line should be ignored.
This code was part of the For the More Curious: The Webshims Library section on page 255.
Chapter 14, page 289, in the section Promise-ifying the other DataStore methods
The last code listing on the page shows what code to remove from DataStore.prototype.add
.
The line this.data[key] = val;
should not be removed.
The final version of DataStore.prototype.add
should be as follows:
DataStore.prototype.add = function (key, val) {
this.data[key] = val;
return promiseResolvedWith(null);
};
Chapter 16, page 319, in the section Creating the Chat Server Functionality
There is a semi-colon missing from the line clientSocket.send(data)
.
The newly added lines should be:
ws.clients.forEach(function (clientSocket) {
clientSocket.send(data);
});
Chapter 17, page 336, in the section Adding the ChatMessage Class
When the serialize
method is added, it shows an older version of the constructor
method.
The entire code listing should appear as follows:
...
class ChatMessage {
constructor({
message: m,
user: u='batman',
timestamp: t=(new Date()).getTime()
}) {
this.message = m;
this.user = u;
this.timestamp = t;
}
serialize() {
return {
user: this.user,
message: this.message,
timestamp: this.timestamp
};
}
}
export default ChatApp;
Chapter 18, pages 353 and 355, in the section Using Gravatars
Screenshots 18.2 and 18.4 are incorrect. At this point in the book, a user is not yet being passed to the ChatMessage
constructor. Therefore, the screenshots should show the default username of 'batman'
.
Chapter 21, page 407, Silver Challenge
Ember already includes the isNew
Boolean attribute to models.
Adding it manually will cause errors.
Chapter 24, page 445, Editing a Sighting
On the fifth line of the first code listing, there is a typo.
The line
{{moment-from model.sightin.sightedAt}}
Should be
{{moment-from model.sighting.sightedAt}}
Chapter 25, page 464, Actions Up
The first code listing instructs the reader to add
close=(action "removeAlert")
In Ember 2.4.3, the action helper doesn’t work for controller or route actions. Instead, use sendAction
in the component, and set close=“removeAlert”