0%

Book Description

Angular Development with TypeScript, Second Edition teaches you how to build web applications with Angular and TypeScript. Written in an accessible, lively style, this illuminating guide covers core concerns like state management, data, forms, and server communication as you build a full-featured online auction app. You’ll get the skills you need to write type-aware classes, interfaces, and generics with TypeScript, and discover time-saving best practices to use in your own work.

Table of Contents

  1. Copyright
  2. Brief Table of Contents
  3. Table of Contents
  4. Praise for the First Edition
  5. Preface
  6. Acknowledgments
  7. About this book
    1. Who should read this book
    2. Where to get the source code
    3. How this book is organized
    4. Book forum
  8. About the authors
  9. About the cover illustration
  10. Chapter 1. Introducing Angular
    1. 1.1. Why select Angular for web development?
    2. 1.2. Why develop in TypeScript and not in JavaScript?
    3. 1.3. Overview of Angular
    4. 1.4. Introducing Angular CLI
    5. 1.5. JIT vs. AOT compilation
    6. 1.6. Introducing the sample ngAuction app
    7. Summary
  11. Chapter 2. The main artifacts of an Angular app
    1. 2.1. Components
    2. 2.2. Services
    3. 2.3. Directives
    4. 2.4. Pipes
    5. 2.5. Modules
    6. 2.6. Understanding data binding
    7. 2.7. Hands-on: Getting started with ngAuction
    8. Summary
  12. Chapter 3. Router basics
    1. 3.1. Routing basics
    2. 3.2. Location strategies
    3. 3.3. The building blocks of client-side navigation
    4. 3.4. Navigating to routes with navigate()
    5. 3.5. Passing data to routes
    6. 3.6. Child routes
    7. 3.7. Hands-on: Adding navigation to the online auction
    8. Summary
  13. Chapter 4. Router advanced
    1. 4.1. Guarding routes
    2. 4.2. Developing an SPA with multiple router outlets
    3. Summary
  14. Chapter 5. Dependency injection in Angular
    1. 5.1. The dependency injection pattern
    2. 5.2. Benefits of DI in Angular apps
    3. 5.3. Injectors and providers
    4. 5.4. A simple app with Angular DI
    5. 5.5. Switching injectables made easy
    6. 5.6. Declaring providers with useFactory and useValue
    7. 5.7. Providers in lazy-loaded modules
    8. 5.8. Providers in eagerly loaded modules
    9. 5.9. Hands-on: Using Angular Material components in ngAuction
    10. Summary
  15. Chapter 6. Reactive programming in Angular
    1. 6.1. Handling events without observables
    2. 6.2. Turning DOM events into observables
    3. 6.3. Handling observable events with the Forms API
    4. 6.4. Discarding results of unwanted HTTP requests with switchMap
    5. 6.5. Using AsyncPipe
    6. 6.6. Observables and the router
    7. Summary
  16. Chapter 7. Laying out pages with Flex Layout
    1. 7.1. Flex Layout and ObservableMedia
    2. 7.2. Hands-on: Rewriting ngAuction
    3. Summary
  17. Chapter 8. Implementing component communications
    1. 8.1. Intercomponent communication
    2. 8.2. Input and output properties
    3. 8.3. Implementing the Mediator design pattern
    4. 8.4. Exposing a child component’s API
    5. 8.5. Projecting templates at runtime with ngContent
    6. Summary
  18. Chapter 9. Change detection and component lifecycle
    1. 9.1. A high-level overview of change detection
    2. 9.2. Component lifecycle
    3. 9.3. Hands-on: Adding the product view to ngAuction
    4. Summary
  19. Chapter 10. Introducing the Forms API
    1. 10.1. Two Forms APIs
    2. 10.2. Template-driven forms
    3. 10.3. Reactive forms
    4. 10.4. Forms API directives summary
    5. 10.5. Updating form data
    6. 10.6. Using FormBuilder
    7. Summary
  20. Chapter 11. Validating forms
    1. 11.1. Using built-in validators
    2. 11.2. Controlling when validation starts
    3. 11.3. Custom validators in reactive forms
    4. 11.4. Validating a group of controls
    5. 11.5. Checking a form control’s status and validity
    6. 11.6. Changing validators dynamically in reactive forms
    7. 11.7. Asynchronous validators
    8. 11.8. Custom validators in template-driven forms
    9. 11.9. Adding a search form to ngAuction
    10. Summary
  21. Chapter 12. Interacting with servers using HTTP
    1. 12.1. Overview of the HttpClient service
    2. 12.2. Reading a JSON file with HttpClient
    3. 12.3. Creating a web server with Node, Express, and TypeScript
    4. 12.4. Bringing Angular and Node together
    5. 12.5. Posting data to the server
    6. 12.6. HTTP interceptors
    7. 12.7. Progress events
    8. Summary
  22. Chapter 13. Interacting with servers using the WebSocket protocol
    1. 13.1. Comparing HTTP and WebSockets
    2. 13.2. Pushing data from a Node server to a plain client
    3. 13.3. Using WebSockets in Angular clients
    4. 13.4. Hands-on: Node server with WebSockets support
    5. Summary
  23. Chapter 14. Testing Angular applications
    1. 14.1. Unit testing
    2. 14.2. Running Jasmine scripts with Karma
    3. 14.3. Using the Angular testing library
    4. 14.4. End-to-end testing with Protractor
    5. 14.5. Hands-on: Adding an E2E test to ngAuction
    6. Summary
  24. Chapter 15. Maintaining app state with ngrx
    1. 15.1. From a convenience store to Redux architecture
    2. 15.2. Introducing ngrx
    3. 15.3. To ngrx or not to ngrx
    4. 15.4. Hands-on: Using ngrx in ngAuction
    5. Summary
    6. Angular 6, 7, and beyond
  25. Appendix A. An overview of ECMAScript
    1. A.1. How to run the code samples
    2. A.2. Scope of variables and this
    3. A.3. Template literals
    4. A.4. Optional parameters and default values
    5. A.5. Arrow function expressions, this, and that
    6. A.6. The rest operator
    7. A.7. The spread operator
    8. A.8. Generator functions
    9. A.9. Destructuring
    10. A.10. Iterating with forEach(), for-in, and for-of
    11. A.11. Classes and inheritance
    12. A.12. Asynchronous processing
    13. A.13. ES6 modules
  26. Appendix B. TypeScript essentials
    1. B.1. The role of transpilers
    2. B.2. Getting started with TypeScript
    3. B.3. How to run the code samples
    4. B.4. Optional types
    5. B.5. Functions
    6. B.6. Classes
    7. B.7. Interfaces
    8. B.8. Generics
    9. B.9. The readonly modifier
    10. B.10. Decorators
    11. B.11. The union type
    12. B.12. Using type definition files
    13. B.13. Controlling code style with TSLint
  27. Appendix C. Using the npm package manager
    1. C.1. Specifying project dependencies in package.json
    2. C.2. Semantic versioning
    3. C.3. Yarn as an alternative to npm
  28. Appendix D. RxJS essentials
    1. D.1. Getting familiar with RxJS terminology
    2. D.2. Observable, observer, and subscriber
    3. D.3. Creating observables
    4. D.4. Getting familiar with RxJS operators
    5. D.5. Using an observer API
    6. D.6. Using RxJS Subject
    7. D.7. The flatMap operator
    8. D.8. The switchMap operator
    9. D.9. Error handling with catchError
  29. Index
  30. List of Figures
  31. List of Tables
  32. List of Listings
44.192.107.255