Leanpub Header

Skip to main content

Practical Angular 2 Book

With Node/npm, Typescript, SystemJS and Visual Studio Code

Create web applications with the new Angular 2 framework that was totally remodeled with new concepts and implementations. 

This book is a translation into English of Angular 2 na prática (PT-BR) which was originally written in Portuguese (Brazilian)

Minimum price

$25.00

$25.00

You pay

$25.00

Authors earn

$20.00
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
283
Readers
213
Pages
24,022Words
About

About

About the Book

This books shows all the steps necessary for the development of SPA (Single Page Application) applications with the brand new Angular 2 (still in beta). With this book you will learn:

  • Complete guide to TypeScript
  • Use of the new Visual Studio Code IDE
  • How to create a project in Angular 2
  • Understand how the SystemJS imports works
  • Components
  • Events
  • Modules
  • Services
  • Template System
  • Using HTTP to connect to a server
  • Bonus:
    • How to install and work with Node/NPM
    • How to work with MongoDB via mongolab
    • How to create a complete ReSTful server with Express
    • Final example code in github
    • Final example with login using JSON Web Token

This book still doesn't addresses the migration from Angular 1 to Angular 2. A new chapter will be added when Angular 2 is officially launched.

Share this book

Categories

This book is a translation into English of Angular 2 na prática (PT-BR) which was originally written in Portuguese (Brazilian)

Author

About the Authors

Daniel Schmitz

Daniel Schmitz is a software developer and writer. He's originally from Brazil and has published several books in Portuguese/English.

Daniel Pedrinha Georgii

Contents

Table of Contents

1.Introduction

  1. 1.1Prerequisites
  2. 1.1.1Node
  3. 1.1.2Web server
  4. 1.1.3The package.json file
  5. 1.1.4Text editors and IDEs
  6. 1.2Besides Javascript
  7. 1.3TypeScript
  8. 1.4Source code

2.TypeScript

  1. 2.1Installing TypeScript
  2. 2.2Using Visual Studio Code
  3. 2.2.1Detecting changes
  4. 2.2.2Debugging Visual Studio Code
  5. 2.2.3Debug on the browser
  6. 2.3Types
  7. 2.3.1Basic types
  8. 2.3.2Arrays
  9. 2.3.3Enum
  10. 2.3.4Any
  11. 2.3.5Void
  12. 2.4Classes
  13. 2.4.1Constructor
  14. 2.4.2Method and properties visibility
  15. 2.5Inheritance
  16. 2.6Accessors (get/set)
  17. 2.7Static Methods
  18. 2.8Interfaces
  19. 2.9Functions
  20. 2.9.1Default value
  21. 2.9.2Optional parameter
  22. 2.10Rest parameters
  23. 2.11Parameters in JSON format
  24. 2.12Modules
  25. 2.12.1Example with Systemjs
  26. 2.12.2Hiding js e map files on VSCode
  27. 2.12.3Using SystemJS
  28. 2.13Decorators (or annotation)
  29. 2.14Conclusion

3.Let’s practice

  1. 3.1AngularBase Project
  2. 3.1.1Setting up the project
  3. 3.1.2Setting up the TypeScript compilation
  4. 3.1.3Creating the first Angular 2 component
  5. 3.1.4Creating the ngModule
  6. 3.1.5Creating the bootstrap
  7. 3.1.6Creating an HTML file
  8. 3.2Creating a playlist
  9. 3.2.1Initial file structure
  10. 3.2.2Creating the application settings file
  11. 3.2.3Adding the bootstrap
  12. 3.2.4Creating the Video class
  13. 3.2.5Creating a simple video list
  14. 3.2.6Creating child components
  15. 3.2.7Formatting the template
  16. 3.2.8Passing values between components
  17. 3.2.9Selecting a video
  18. 3.2.10Events
  19. 3.2.11Event Bubbling
  20. 3.2.12Showing the video details
  21. 3.2.13Editing the selected video data
  22. 3.2.14Editing the title
  23. 3.2.15Creating a new item
  24. 3.2.16Some considerations
  25. 3.3Creating Components
  26. 3.4Hierarchical components

4.Some theory

  1. 4.1Overview
  2. 4.2Module
  3. 4.2.1Library Module
  4. 4.3ngModule
  5. 4.4Component
  6. 4.5Template
  7. 4.5.1Interpolation (Using {{ }})
  8. 4.5.2Template Expressions
  9. 4.6Property Bind
  10. 4.6.1Loops
  11. 4.6.2Pipes (Operator |)
  12. 4.7Metadata (annotation)
  13. 4.8Service
  14. 4.9Dependency injection
  15. 4.9.1Using the @Injectable()

5.Forms

  1. 5.1Creating the base project
  2. 5.2Using the ngControl
  3. 5.3Showing an error message
  4. 5.4Disabling the submit button of the form
  5. 5.5Submitting the form
  6. 5.6Controlling the form visibility

6.Connecting to a server

  1. 6.1Creating the project
  2. 6.2ngModule
  3. 6.3Using the Http class
  4. 6.4Using services
  5. 6.5Organizing the project
  6. 6.6User model
  7. 6.7User service
  8. 6.8Changing the AppComponent component
  9. 6.9Submitting data

7.Routes

  1. 7.1Applying AngularRoutes
  2. 7.2Splitting the application in smaller parts
  3. 7.3Creating the area where the components will be created
  4. 7.4Setting up the Router
  5. 7.5Creating route links
  6. 7.6Passing parameters

8.Final example - Server

  1. 8.1Creating the RESTful server
  2. 8.2The MongoDB data base
  3. 8.3Creating the project
  4. 8.4The project structure
  5. 8.5Setting up the MondoDB models
  6. 8.6Setting up the Express server
  7. 8.7Testing the server
  8. 8.8Testing the API without Angular

9.Final Example - Client application

  1. 9.1First files
  2. 9.2The base template for the application
  3. 9.3Implementing the routing
  4. 9.3.1Creating the components
  5. 9.3.2Setting up the @RouteConfig
  6. 9.3.3Setting up the menu
  7. 9.3.4Setting up the router-outlet
  8. 9.4Showing Posts
  9. 9.5Login
  10. 9.6Services
  11. 9.6.1LoginService
  12. 9.6.2UserService
  13. 9.6.3HeadersService
  14. 9.7Connecting to the server
  15. 9.8Posts
  16. 9.8.1PostService
  17. 9.9Refactoring the home screen
  18. 9.10Conclusion

10.Using Sublime Text

  1. 10.1Installation
  2. 10.2Adding support to TypeScript language
  3. 10.3Automating the TypeScript build

11.Publishing the App in a Cloud Server

  1. 11.1Creating a new account on Digital Ocean
  2. 11.2Creating the droplet (server)
  3. 11.3Setting up the SSH access
  4. 11.4Creating the user
  5. 11.5Installing git
  6. 11.6Installing Node
  7. 11.7Installing nginx
  8. 11.8Installing Node modules
  9. 11.9Recompiling the TypeScript files
  10. 11.10First test
  11. 11.11Integration between nginx and node
  12. 11.12Some considerations about node+nginx
  13. 11.13Domain
  14. 11.14Conclusion

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub