Learning Angular, 2nd Edition

Book description

Learning Angular, Second Edition

A Hands-On Guide to Angular 2 and Angular 4

Learning Angular teaches modern application development with Angular 2 and Angular 4. It begins with the basics of Angular and the technologies and techniques used throughout the book, such as key features of TypeScript, newer ES6 syntax and concepts, and details about the tools needed to write professional Angular applications.

The reader will next build an Angular application from scratch while learning about the primary pieces of an Angular application and see how they work together. Using lots of examples, the core parts of Angular will be introduced, such as Components, the Router, and Services.

The book also covers techniques like server-side rendering and how to incrementally add Angular 2+ features to existing AngularJS applications. Finally, the reader will gain insight into advanced skills that should be part of any professional Angular developer’s toolkit such as testing, tooling options, and performance tuning.

  • Understand how Angular is organized and learn best practices for designing Angular applications
  • Quickly build Angular templates with built-in directives that enhance the user experience
  • Bind UI elements to your data model, so changes to your model and UI occur automatically in tandem
  • Define custom Angular directives that extend HTML
  • Implement zoomable images, expandable lists, and other rich UI components
  • Implement client-side services that interact with web servers
  • Build dynamic browser views to provide even richer user interaction
  • Create custom services you can easily reuse
  • Implement rich UI components as custom Angular directives

Contents at a Glance

Introduction

  • What is Angular
  • Why Use Angular
  • Who this Book is For
  • How to Use this Book
  • Getting the Source Code

Chapter 1: Jumping into JavaScript

  • Setting Up a JavaScript Development Environment
  • Defining Variables
  • Understanding JavaScript Data Types
  • Using Operators
  • Implementing Looping
  • Creating Functions
  • Understanding Variable Scope
  • Using JavaScript Objects
  • Manipulating Strings
  • Working with Arrays
  • Adding Error Handling

Chapter 2: Jumping into TypeScript

  • Learning the Different Types
  • Understanding Interfaces
  • Implementing Classes
  • Implementing Modules
  • Understanding Functions

Chapter 3: Getting Started with Angular

  • Why Angular?
  • Understanding Angular
  • Separation of Responsibilities
  • Adding Angular to Your Environment
  • Using the Angular CLI
  • Creating a Basic Angular Application

Chapter 4: Angular Components

  • Component Configuration
  • Building the Template
  • Using Constructors
  • Using External Templates
  • Implementing Directives

Chapter 5: Expressions

  • Using Expressions
  • Using Pipes
  • Building a Custom Pipe

Chapter 6: Data Binding

  • Understanding Data Binding
  • Interpolation
  • Property Binding
  • Attribute Binding
  • Class Binding
  • Style Binding
  • Event Binding
  • Two-Way Binding

Chapter 7: Built-in Directives

  • Understanding Directives
  • Using Built-in Directives
  • Structural Directives
  • Attribute Directives

Chapter 8: Custom Directives

  • Creating a Custom Attribute Directive
  • Creating a Custom Directive with a Component

Chapter 9: Events and Change Detection

  • Using Browser Events
  • Emitting Custom Events
  • Using Observables

Chapter 10: Implementing Angular Services in Web Applications

  • Understanding Angular Services
  • Using the Built in Services
  • Sending HTTP GET and PUT Requests with the http Service
  • Implementing a Simple Mock Server Using the http Service
  • Changing Views with the router Service
  • Implementing a Router with a Navigation Bar
  • Implementing a Router with Parameters

Chapter 11: Creating Your Own Custom Angular Service

  • Integrating Custom Services into Angular Applications
  • Implementing a Simple Application That Uses a Constant Data Service
  • Implementing a Data Transform Service
  • Implementing a Variable Data Service
  • Implementing a Service that Returns a Promise
  • Implementing a Shared Service

Chapter 12: Having Fun with Angular

  • Implementing an Angular Application That Uses the Animation Service
  • Implementing an Angular Application That Zooms in on Images
  • Implementing an Angular Application That Enables Drag and Drop
  • Implementing a Star Rating Angular Component

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Contents At a Glance
  5. Contents
  6. About the Author
  7. Acknowledgments
  8. We Want to Hear from You!
  9. Reader Services
  10. Accessing the Free Web Edition
  11. Introduction
  12. 1 Jumping into JavaScript
    1. Setting Up a JavaScript Development Environment
    2. Defining Variables
    3. Understanding JavaScript Data Types
    4. Using Operators
      1. Arithmetic Operators
      2. Assignment Operators
      3. Applying Comparison and Conditional Operators
    5. Implementing Looping
      1. while Loops
      2. do/while Loops
      3. for Loops
      4. for/in Loops
      5. Interrupting Loops
    6. Creating Functions
      1. Defining Functions
      2. Passing Variables to Functions
      3. Returning Values from Functions
      4. Using Anonymous Functions
    7. Understanding Variable Scope
    8. Using JavaScript Objects
      1. Using Object Syntax
      2. Creating Custom Defined Objects
      3. Using a Prototyping Object Pattern
    9. Manipulating Strings
      1. Combining Strings
      2. Searching a String for a Substring
      3. Replacing a Word in a String
      4. Splitting a String into an Array
    10. Working with Arrays
      1. Combining Arrays
      2. Iterating Through Arrays
      3. Converting an Array into a String
      4. Checking Whether an Array Contains an Item
      5. Adding Items to and Removing Items from Arrays
    11. Adding Error Handling
      1. try/catch Blocks
      2. Throwing Your Own Errors
      3. Using finally
    12. Summary
  13. 2 Jumping into TypeScript
    1. Learning the Different Types
    2. Understanding Interfaces
    3. Implementing Classes
      1. Class Inheritance
    4. Implementing Modules
    5. Understanding Functions
    6. Summary
  14. 3 Getting Started with Angular
    1. Why Angular?
    2. Understanding Angular
      1. Modules
      2. Directives
      3. Data Binding
      4. Dependency Injection
      5. Services
    3. Separation of Responsibilities
    4. Adding Angular to Your Environment
    5. Using the Angular CLI
      1. Generating Content with the CLI
    6. Creating a Basic Angular Application
      1. Creating Your First Angular App
      2. Understanding and Using NgModule
      3. Creating the Angular Bootstrapper
    7. Summary
  15. 4 Angular Components
    1. Component Configuration
      1. Defining a Selector
    2. Building a Template
      1. Using Inline CSS and HTML in Angular Applications
    3. Using Constructors
    4. Using External Templates
    5. Injecting Directives
      1. Building a Nested Component with Dependency Injection
      2. Passing in Data with Dependency Injection
      3. Creating an Angular Application that Uses Inputs
    6. Summary
  16. 5 Expressions
    1. Using Expressions
      1. Using Basic Expressions
      2. Interacting with the Component Class in Expressions
      3. Using TypeScript in Angular Expressions
    2. Using Pipes
      1. Using Built-in Pipes
      2. Using Built-in Pipes
    3. Building a Custom Pipe
      1. Creating a Custom Pipe
    4. Summary
  17. 6 Data Binding
    1. Understanding Data Binding
      1. Interpolation
      2. Property Binding
      3. Attribute Binding
      4. Class Binding
      5. Style Binding
      6. Event Binding
      7. Two-Way Binding
    2. Summary
  18. 7 Built-in Directives
    1. Understanding Directives
    2. Using Built-in Directives
      1. Components Directives
      2. Structural Directives
      3. Attribute Directives
    3. Summary
  19. 8 Custom Directives
    1. Creating a Custom Attribute Directive
    2. Creating a Custom Directive with a Component
    3. Summary
  20. 9 Events and Change Detection
    1. Using Browser Events
    2. Emitting Custom Events
      1. Emitting a Custom Event to the Parent Component Hierarchy
      2. Handling Custom Events with a Listener
      3. Implementing Custom Events in Nested Components
      4. Deleting Data in a Parent Component from a Child Component
    3. Using Observables
      1. Creating an Observable Object
      2. Watching for Data Changes with Observables
    4. Summary
  21. 10 Implementing Angular Services in Web Applications
    1. Understanding Angular Services
    2. Using the Built-in Services
    3. Sending HTTP GET and PUT Requests with the http Service
      1. Configuring the HTTP Request
      2. Implementing the HTTP Response Callback Functions
      3. Implementing a Simple JSON File and Using the http Service to Access It
    4. Implementing a Simple Mock Server Using the http Service
      1. Implementing a Simple Mock Server and Using the http Service to Update Items on the Server
    5. Changing Views with the router Service
      1. Using routes in Angular
      2. Implementing a Simple Router
    6. Implementing a Router with a Navigation Bar
    7. Implementing a Router with Parameters
    8. Summary
  22. 11 Creating Your Own Custom Angular Services
    1. Integrating Custom Services into Angular Applications
      1. Adding an Angular Service to an Application
    2. Implementing a Simple Application that Uses a Constant Data Service
    3. Implementing a Data Transform Service
    4. Implementing a Variable Data Service
    5. Implementing a Service that Returns a Promise
    6. Implementing a Shared Service
    7. Summary
  23. 12 Having Fun with Angular
    1. Implementing an Angular Application that Uses the Animation Service
    2. Implementing an Angular Application that Zooms in on Images
    3. Implementing an Angular Application that Enables Drag and Drop
    4. Implementing a Star Rating Angular Component
    5. Summary
  24. Index

Product information

  • Title: Learning Angular, 2nd Edition
  • Author(s): Brad Dayley, Brendan Dayley, Caleb Dayley
  • Release date: October 2017
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780134577074