"Everybody has a plan until they get punched in the mouth." -Mike Tyson, undisputed heavyweight champion boxer
Soon after its creation in 2009, AngularJS grew into a widely popular foundational tool for building frontend applications. As years and releases went by, and the JavaScript community matured, the world of client-side programming broadened beyond what Angular was originally designed for. Its caretakers took stock and decided that a sweeping overhaul of the framework was in order.
AngularJS, now Angular 1, still exists and will be supported for the years to come, but in its wake lies Angular 2—a wholly different animal built for the future of client-side computing. Angular 2 abandons antipatterns by the fistful and, instead, is reshaped into a precise and elegant software instrument. It embraces the impending renaissance of web technologies, building atop ES6, web components, web workers, TypeScript, and reactive programming, to name a few. It brings framework modularity to new heights, building itself around the concept that any modular piece of Angular 2 should be easily discarded or replaced. Best of all, Angular 2 offers a bountiful collection of configuration and tooling that will make your applications run at breakneck speed.
To many developers, Angular 2 is frightening because so much of it is new and unfamiliar. This book exists to offer you an approachable path to a full understanding of Angular 2, what it offers, and how best to use it. You will find both simple examples to set a foundational understanding, and complex demonstrations to hint at the framework's power. The book is organized into recipes that are independent of each other, so you are able to jump in at any point and immediately begin learning.
This book is up to date for the 2.4 release and is compatible through the 4.0 release as well, and it does not have any code based on the beta or release candidates.
, Strategies for Upgrading to Angular 2, is an overview of a number of ways to migrate an Angular 1 application to Angular 2. Although there is no one-size-fits-all upgrade strategy, you will find that these recipes demonstrate some ways that will allow you to preserve a large amount of your existing Angular 1 code base.
, Conquering Components and Directives, gives a broad and deep set of examples involving what Angular 2 components are and how to use them. Angular 2 applications are built entirely of components, and this chapter offers you a total rundown of their role.
, Building Template-Driven and Reactive Forms, covers the reworked Angular 2 form modules. Angular 2 offers you two primary styles of erecting form features, and this chapter covers both of them in depth.
, Mastering Promises, shows how the Promise object has a role in Angular 2. Although RxJS has subsumed some of the usefulness of Promises, they are still first-class citizens in ES6 and still play a crucial role.
, ReactiveX Observables, gives you a crash course in how Angular 2 has embraced reactive programming. It includes recipes that demonstrate the basics of Observables and Subjects, as well as advanced implementations that take RxJS to its limits.
, The Component Router, takes you through the totally reworked routing module in Angular 2. It covers both routing basics as well as an array of advanced routing concepts unique to Angular 2.
, Services, Dependency Injection, and NgModule, describes the new and improved dependency injection and module strategies of Angular 2. It gives you all the pieces you need to break your application into independent services and modules, as well as ideal strategies for connecting those pieces together.
, Application Organization and Management, is a broad overview of how you can manage your Angular 2 application inside and outside the client. Angular 2 introduces a number of layers of complexity that require advanced tooling, and this chapter will guide you through how to approach them.
, Angular 2 Testing, will guide you through both how to set up test suites for Angular 2 as well as how to write various types of tests for these suites. Many developers avoid testing when learning a framework anew, and this chapter gently guides you through Angular 2's excellent test infrastructure.
, Performance and Advanced Concepts, is a crash course on the dizzying array of complex concepts that Angular 2 comes with out of the box. This chapter covers program organization and architecture, framework features and tooling, as well as compile-time optimizations.