Table of Contents for
Angular: Up and Running
Close
Version ebook
/
Retour
Angular: Up and Running
by Shyam Seshadri
Published by O'Reilly Media, Inc., 2018
Cover
nav
Angular: Up and Running
Angular: Up and Running
Introduction
1. Introducing Angular
2. Hello Angular
3. Useful Built-In Angular Directives
4. Understanding and Using Angular Components
5. Testing Angular Components
6. Working with Template-Driven Forms
7. Working with Reactive Forms
8. Angular Services
9. Making HTTP Calls in Angular
10. Unit Testing Services
11. Routing in Angular
12. Productionizing an Angular App
Index
About the Author
Colophon
Introduction
Who Should Read This Book
Why I Wrote This Book
A Word on Web Application Development Today
Navigating This Book
Online Resources
Conventions Used in This Book
Using Code Examples
O’Reilly Safari
How to Contact Us
Acknowledgments
1. Introducing Angular
Why Angular
What This Book Will Not Cover
Getting Started with Your Development Environment
Node.js
TypeScript
Angular CLI
Getting the Codebase
Conclusion
2. Hello Angular
Starting Your First Angular Project
Understanding the Angular CLI
Running the Application
Basics of an Angular Application
Root HTML—index.html
The Entry Point—main.ts
Main Module—app.module.ts
Root Component—AppComponent
Creating a Component
Steps in Creating New Components
Using Our New Component
Understanding Data Binding
Understanding Property Binding
Understanding Event Binding
Using Models for Cleaner Code
Conclusion
Exercise
3. Useful Built-In Angular Directives
Directives and Components
Built-In Attribute Directives
NgClass
NgStyle
Alternative Class and Style Binding Syntax
Built-In Structural Directives
NgIf
NgFor
NgSwitch
Multiple Sibling Structural Directives
Conclusion
Exercise
4. Understanding and Using Angular Components
Components—A Recap
Defining a Component
Selector
Template
Styles
Style Encapsulation
Others
Components and Modules
Input and Output
Input
Output
Change Detection
Component Lifecycle
Interfaces and Functions
View Projection
Conclusion
Exercise
5. Testing Angular Components
Why Unit Test?
Testing and Angular
The Test Setup
Karma Config
test.ts
Writing Unit Tests
An Isolated Unit Test
Running the Tests
Writing an Angular-Aware Unit Test
Testing Component Interactions
Debugging
Conclusion
Exercise
6. Working with Template-Driven Forms
Template-Driven Forms
Setting Up Forms
Alternative to ngModel—Event and Property Binding
ngModel
A Complete Form
Control State
Control Validity
Working with FormGroups
Conclusion
Exercise
7. Working with Reactive Forms
Reactive Forms
Understanding the Differences
Using Reactive Forms
Form Controls
Form Groups
Form Builders
Form Data
Control State, Validity, and Error Messages
Form and Data Model
FormArrays
Conclusion
Exercise
8. Angular Services
What Are Angular Services?
Creating Our Own Angular Service
Digging into the Example
An Introduction to Dependency Injection
Angular and Dependency Injection
RxJS and Observables: Moving to Asynchronous Operations
Conclusion
Exercise
9. Making HTTP Calls in Angular
Introducing HttpClient
Server Setup
Using HttpClientModule
Making HTTP GET/POST Calls
Advanced HTTP
Options—Headers/Params
Options—Observe/Response Type
Interceptors
Advanced Observables
Conclusion
Exercise
10. Unit Testing Services
How to Unit Test Services
Testing Components with a Service Dependency
Testing Components with a Real Service
Testing Components with a Mock Service
Testing Components with a Fake Service
Unit Testing Async
Unit Testing HTTP
Conclusion
Exercise
11. Routing in Angular
Setting Up Angular Routing
Server Setup
Starting Codebase
Importing the Router Module
Displaying the Route Contents
Navigating Within the Application
Wildcards and Defaults
Common Routing Requirements
Required Route Params
Navigating in Your Application
Optional Route Params
Route Guards
Authenticated-Only Routes
Preventing Unload
Preloading Data Using Resolve
Conclusion
Exercise
12. Productionizing an Angular App
Building for Production
Production Build
Ahead-of-Time (AOT) Compilation and Build Optimizer
Base Href
Deploying an Angular Application
Other Concerns
Caching
API/Server Calls and CORS
Different Environments
Handling Deep-Linking
Lazy Loading
Server-Side Rendering and Handling SEO
Conclusion
Index