Book Image

Accelerating Angular Development with Ivy

By : Lars Gyrup Brink Nielsen, Mateus Carniatto, Jacob Andresen
Book Image

Accelerating Angular Development with Ivy

By: Lars Gyrup Brink Nielsen, Mateus Carniatto, Jacob Andresen

Overview of this book

Angular Ivy is the latest rendering engine and compiler introduced in Angular. Ivy helps frontend developers to make their Angular applications faster, better optimized, and more robust. This easy-to-follow guide will help you get to grips with the new features of Angular Ivy and show you how to migrate your Angular apps from View Engine to Ivy. You'll begin by learning about the most popular features of Angular Ivy with the help of simple stand-alone examples and realize its capabilities by working on a real-world application project. You'll then discover strategies to improve your developer workflow through new debugging APIs, testing APIs, and configurations that support higher code quality and productive development features. Throughout the book, you'll explore essential components of Angular, such as Angular Component Dev Kit (CDK), Ahead-of-time (AOT) compilation, and Angular command line interface (CLI). Finally, you'll gain a clear understanding of these components along with Angular Ivy which will help you update your Angular applications with modern features. By the end of this Angular Ivy book, you will learn about the core features of Angular Ivy, discover how to migrate your Angular View Engine application, and find out how to set up a high-quality Angular Ivy project.
Table of Contents (14 chapters)

Dealing with the ahead-of-time compiler's limitations

The upside of using Angular Ivy's ahead-of-time compiler is faster runtime speed and a smaller bundle because of not having to ship a compiler to the runtime bundle or compiler before rendering the application.

When using the ahead-of-time compiler, there is a trade-off to be aware of. Declarables—that is, directives, components, and pipes—cannot rely on runtime information because they must be compiled ahead of time, that is, at build time rather than at runtime.

This sets a limitation for dynamically creating declarables at runtime, for example, based on server-side configuration or a static configuration file. Unless, of course, we bundle the Angular compiler with our application and use it at runtime, but then what would be the point?

The good news is that injected dependencies—that is, class-based services, provided values, or functions—can be resolved at runtime. Keep in mind...