Susan Harkins (212) [Avatar] Offline
#1
Please post errors found in the published version of Angular 2 Development with TypeScript here. We'll publish a comprehensive list for everyone's convenience. Thank you!

Susan Harkins
Errata Editor
Manning Publications
invegat (22) [Avatar] Offline
#2
In A.7.2 on page 373 while correct syntax it should be "console.log(a1.counter)" and "console.log(a2.counter)"
invegat (22) [Avatar] Offline
#3
Table B-7 on page 409 is chopped off before the "array.concat(value1,value2,valu3,....................valuen)" and it's description.
ryan.waskiewicz (4) [Avatar] Offline
#4
Section 3.8.2 - Listing 3.21 - home.ts

The listing here is missing the following import statement for Product and ProductService:

import { Product, ProductService } from '../../services/product-service';


Without it, the following error is shown:

'Error: (SystemJS) Can't resolve all parameters for HomeComponent: (?)'

This import is included in the latest source code
PollekePiekhaar (3) [Avatar] Offline
#5
par 3.8:" '@angular/router' : {main: 'router.umd.min.js'}," should be added to packages in systemjs.config.js. This is not mentioned in the text (and was not required in par 2)..

par 3.8.5, page 106: "The value for prodTitle will be provided in ProductItemComponent, where the routerLink was defined."
Replace "ProductItemComponent" by "ProductDetailComponent"
PollekePiekhaar (3) [Avatar] Offline
#6
PollekePiekhaar wrote:par 3.8:" '@angular/router' : {main: 'router.umd.min.js'}," should be added to packages in systemjs.config.js. This is not mentioned in the text (and was not required in par 2)..

par 3.8.5, page 106: "The value for prodTitle will be provided in ProductItemComponent, where the routerLink was defined."
Replace "ProductItemComponent" by "ProductDetailComponent"


Listing 5.9 page 167: replace "import {FilterPipe} from '../pipes/filter-pipe' " with " import {FilterPipe} from '../../pipes/filter-pipe' "
cfjedimaster (24) [Avatar] Offline
#7
Sorry I can't tell you the page number as Kindle is a bit weird about that, but in Listing 2.2, there is this code comment:

"Inside the constructor, you initialize the name property with the value Angular 2 bound to the template."

But in the code, it is just "Angular", not "Angular 2"
ryan.waskiewicz (4) [Avatar] Offline
#8
The link on page 163 (http://mng.bz/78lD) appears to be broken. It attempts to resolve to https://angular.io/docs/ts/latest/api/common/index/DatePipe-class.html
but I'm guessing it is supposed to resolve to https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html
invegat (22) [Avatar] Offline
#9
On page 92 "Note the parentheses in the URL of the auxiliary route, http://localhost:8080/ #home/(chat)" the correct route is " http://localhost:8080/#/home(aux:chat)"
ryan.waskiewicz (4) [Avatar] Offline
#10
On page 185 in section 6.1.3, the text states '...the main DOM tree, and the styles weren’t encapsulated—the entire window is shown with the parent’s light green background.' However, the light green background is defined on the child component level
377074 (5) [Avatar] Offline
#11
First Let me say that this is my third book that I have from Mr. Yakov Fain.
I'm half way through this one and very pleased.


page 55 ...the three the most... extra the

small typo page 95 (middle of the page) RootModule ---- I think should have been RouterModule

page 99 ...will be lazy-loaded and you we didn't... --- I think the we is not needed here

page 175 some code is missing in the printed book (listing 6.3) but it is in the code sample and works

class AppComponent {

stockSymbol: string;
price:number;

priceQuoteHandler(event:IPriceQuote) {
this.stockSymbol = event.stockSymbol;
this.price = event.lastPrice;
}
}

page 181 ..when the value of the buy input property... I think you intended to write ...the stock input property



code: I am using IntelliJ IDEA and working through the code samples ( npm install locale for each chapter)
making sure they all compile in the ide and in the browser I make sure that I use the latest npm files ( add ^ to all in the package.jason and verify in the ide that they are all up to date)


chapter 5 listing 5.6

@Pipe({name: 'temperature'})
export class TemperaturePipe implements PipeTransform {

transform(value: any[], fromTo: string): any {........

it works in the browser but in the IDE I get
Error (14, 20) TS2362:The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.


when changing to

transform(value: number, fromTo: string): any {.....

it is OK




chapter 6
export interface Stock {....

does not work in browser ( even with the Meta in the system.config.js)

this works

export class Stock {
stockSymbol: string;
bidPrice: number;
}

Thanks again for a great book
ryan.waskiewicz (4) [Avatar] Offline
#12
Listing 8.8, main-asyncpipe.ts, is missing the following import statement:

import 'rxjs/add/operator/map';


This import is however included in the source code. Typing the listing out and running it as is (in the book) results in a runtime error
377074 (5) [Avatar] Offline
#13
on page 249 listing 8.6 missing in the package.jason (in dependencies)

"reflect-metadata": "^0.1.8",


it is needed for page 266 listing 8.18

<script src="node_modules/reflect-metadata/Reflect.js"></script>

is it missing in the print and in the code
399111 (3) [Avatar] Offline
#14
In appendix A.2 template literals it states:
You can embed expressions inside the literal by placing them between curly braces prefixed with a dollar sign.

But the examples are without dollar sign and don't work.


laris (5) [Avatar] Offline
#15
Listing2.10 is incorrect in PDF and differs from the git version
invegat (22) [Avatar] Offline
#16
In Listing 5.4 on page 157 the line "console.log(`The price of stock ${stock} is ${100*Math.random().toFixed(4)}`) should be
console.log(`The price of stock ${stock} is ${(100*Math.random()).toFixed(4)}`)
without the added ()
[ts] The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
377074 (5) [Avatar] Offline
#17

per your request from page 268 "...you should perform a detailed code review..."

In the Auction program from chapter 8 selecting 'All categories' in the Product category drop down is not working

in ../chapter8/auction/client/app/components/search/search.html line 39


<option value="-1">All categories</option> ///// this sends localhost:8000/products?category=-1 ---- fails to return any products from the server

to

<option value="">All categories</option> ///// this sends localhost:8000/products -----( no category ) and works


also in ../chapter8/auction/server/model.ts line 34


p => p.categories.indexOf(params.category.toLowerCase()) !== -1);

can just be

p => p.categories.indexOf(params.category.toLowerCase()));




also in ../chapter8/auction/client/app/services/product-service.ts line 28, 30 and 31

export interface ProductSearchParams {
title: string;
minPrice: number;
maxPrice: number;
}


should be


export interface IProductSearchParams {
title: string;
price: number;
category: string;
}



and then in line 40

search(params: IProductSearchParams): Observable<Product[]> {

(it works without the changes but TypeScript likes the interface to start with the capital I)



I’m using TypeScript 2.1.5 , Angular 2.4.5 and Node 6.9.2
450105 (1) [Avatar] Offline
#18
Page 11 and Figure 1.4: there is:
class SearchComponent {
  product: Product;
  findProduct(prodToFind.value){
   // Implementation of the
   // click handler goes here
  }
}

but in the listing above:
class SearchComponent {
 @Input() productID: number;
 product: Product; // code of the Product class is omitted
 findProduct(prodName: string){
  // Other code can go here
 }
}

Can I use this prodToFind.value as an argument in the findProduct method definition? Or maybe it is some pseudocode here and not any implicit magic here.

Sorry If this is correct. I'm just a beginner.
377074 (5) [Avatar] Offline
#19
page 317 listing 10.6 (book and code)

path: './dist',

not working with webpack 2.2.1 when running the webpack-dev-server

path: '/dist',

works ( no dot )

when running webpack (that actually creates the dist directory) the dot is needed



also, in the book

entry: {
'main': './main'
},


in the download code

entry: './main',

both work other way...
Mike Kabala (8) [Avatar] Offline
#20
On page 27, the text states, "Notice how in listing 2.2 the entire template is wrapped in backticks to turn the template into a string." However, both the code listing on page 26 and the main.ts file from the downloaded code enclose this template in single quotes. I tested the code both ways and they both work, but since the use of backticks was specifically called out in the text, the listing should probably actually use the backtick character.
Mike Kabala (8) [Avatar] Offline
#21
On page 47, the text states that live-server was installed "in section 2.4.1." Actually, it was installed in section 2.1.4.
invegat (22) [Avatar] Offline
#22
The note the top of page 192 is out of phase with ngOnChanges code on page 191. To get the note in phase change it to:
"TypeScript has a structural type system, so the type of the argument
changes of ngOnChanges() is specified by including an interface that specifies a structure. As an alternative, you could specify a structure inline
{[key: string]: SimpleChange} and the function
signature would look like ngOnChanges(changes: {[key: string]: SimpleChange}). The preceding
declaration of the user property in AppComponent is yet another example of
using the structural type."
invegat (22) [Avatar] Offline
#23
Table 7.4 on page 214 has some extraneous texts "2((CO7-2))" and "2((CO7-3))"
Yakov Fain (159) [Avatar] Offline
#24
Chapter 10, section "Using Webpack Dev Server".
I just upgraded both webpack and webpack-dev-server to 2.2.0, and the output section (specifically ./dist)in webpack.config.js started causing errors when you run webpack-dev-server. Remove the leading dot so it's /dist.

I pushed the new version of hello-world-dev-server to Github:
https://github.com/Farata/angular2typescript

rbroen (2) [Avatar] Offline
#25
Appendix A, page 366, wrong variable name
In Appendix A, page 366:
let {sym, price, stockExchange} = getStock();

should be:
let {symbol, price, stockExchange} = getStock();


invegat (22) [Avatar] Offline
#26
On page 247 change "(run nodemon build/auction-rest-server.js)" to "(if nodemon is installed globally run 'nodemon build/auction-rest-server.js'; otherwise edit the "dev" script in package.json)
Puneet Lamba (11) [Avatar] Offline
#27
Page 112
IoT (Internet of Things) should be IoC (Inversion of Control). Freudian slip.
invegat (22) [Avatar] Offline
#28
On page 260 it should be "npm run simpleWsServer", not "npm simpleWsServer"
Puneet Lamba (11) [Avatar] Offline
#29
Excellent book. p. 144, line 1. "DOM attribute" should be "DOM property" to be consistent with HTML attributes and DOM properties.
Puneet Lamba (11) [Avatar] Offline
#30
p. 149.

Awesome book. But some errors always slip through. Also I could be wrong.

Towards the end of the page, "one-way binding from a component to the UI is denoted by surrounding an HTML attribute with square brackets". Well, yes, but I thought we were promoting DOM property based bindings.
Puneet Lamba (11) [Avatar] Offline
#31
Page 164 talks about the need to list custom pipes in the @Component annotation's pipes property, however listing 5.7 only seems to list the custom pipe in the @NgModule declarations property.
Yakov Fain (159) [Avatar] Offline
#32
Listing 8.16:

import {Observable } from 'rxjs/Observable';

export class WebSocketService{

    ws: WebSocket;

    createObservableSocket(url:string):Observable<any>{...}
Jun (2) [Avatar] Offline
#33
I purchased the Kindle version and Listings 2.1 and 2.3 reference
unpkg.com/zone.js@0.6.12


After failing to get it working, bit the bullet and downloaded the source and found that it should be referencing
unpkg.com/zone.js@0.6.21

433015 (1) [Avatar] Offline
#34
Page 179, line 7.

mediator.ts - PriceQuoterComponent and OrderComponent (WRONG)

mediator.ts - AppComponent (CORRECT)
Susan Harkins (212) [Avatar] Offline
#35
An errata list can be accessed at https://rawgit.com/farata/angular2typescript/c8fd6fe8dfc97f42371240ec762c1f6555d2aaf0/Errata.html. Thanks!

Susan Harkins
Errata Editor
465737 (3) [Avatar] Offline
#36
Page 136, Listing 4.12

"Date.parse(r.timestamp)" should be "new Date(r.timestamp)"
as in the code samples with the chapter.
465737 (3) [Avatar] Offline
#37
Chapter 5:
Auction Chap 4 to Auction Chap 5
Missing add to system.config.js:
'@angular/forms' : {main: 'forms.umd.min.js'},

Chapter 3 Auction to Chapter 4 Auction do not include the changes to
Search.ts + Search.html (which causes app to crash for chapter 4 to 5 changes)

Based on code samples included.
465737 (3) [Avatar] Offline
#38
Chapter 6
Auction 5 to Auction 6

In app.module.ts

import { ReactiveFormsModule, FormsModule } from '@angular/forms';
Add FormsModule to App imports

(error with textarea [(ngModel)]) if not added.