Skip to content
Code samples from the book Angular 2 Development with TypeScript
Branch: master
Clone or download
Latest commit eb3b824 Oct 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
appendixa Update forof.html May 17, 2017
appendixb a bug fix with pipes sample plus recovery of the accidentally deleted… Oct 7, 2016
chapter4 Update product.ts Apr 8, 2017
chapter5 Merge branch 'master' of Oct 3, 2018
chapter8 Added lots of TypeScript code samples May 9, 2017
chapter9 Fix ch9/test_weather tests Apr 3, 2017
extras updated to CLI 1.4.3 Sep 27, 2017
Errata.adoc updated Errata file Oct 3, 2018
Errata.html updated Errata file Oct 3, 2018

This is a repository for code samples for the book by Yakov Fain and Anton Moiseev Angular 2 Development with TypeScript, First Edition.

The code samples of the second edition of this book, are located here. All of those sample projects are Angular CLI based (no SystemJS) and they were written in Angular 5.

Plese send us your Angular training and consulting requests at

Besides the original code samples (they work with Angular 2) we created Angular 4 versions of most code samples (these projects were generated by Angular CLI).

NOTE: The folder extras has some apps that use Angular Material 2 and PrimeNG libraries. It also has additional code samples illustrating various TypeScript features.

Reporting errors: If you'll run into a bug in the code, please open an issue here. If you want to report errors or typos in the book text, please report it at the book's forum in the Errata section. We started reading all submissions and created an Errata page with corrections.

Watch the video with a code review of a sample online auction application that we gradually develop in the book.

More recent videos are located here.

The Angular CLI version of the projects

After the book was published we've created additional versions of book samples using Angular-CLI generated projects as in this video. These code samples are located in the directory Angular4, which has several subdirectories. Each of those is an Angular CLI project with several sample applications. Each of these applications has a bootstrap file with the name that starts with main (see the src directory).

To run any of these applications, change into the required directory and run npm install. The file .angular-cli.json may configure one or more apps. If there only one app configured per project (default), modify the property main in the file .angular-cli.json to point at the bootstrap file you want to run. After that, run ng serve and open your browser at localhost:4200.

If several apps are configured in .angular-cli.json project (as in the project inter-component), run a specific app by name. For example, the project inter-component has an app main-mediator-parent.ts, which is configured in .angular-cli.json as mediator1. You can run it with the following command:

ng serve --app mediator1 -o

Code samples located in the folders http-node-samples and auction require two separate terminal windows: one for running the Node server and another - to bundle and deploy the client. In the client dir: npm run build. In the server dir: 1. compile the code: npm run tsc 2) npm run devRestAngular (in auction/server it's npm run startServer). Then open your browser at localhost:8000.

The folder test-weather contains a sample app from chapter 9. Run unit tests with ng test.

You can’t perform that action at this time.