Accelerating Angular Development with Ivy
eBook - ePub

Accelerating Angular Development with Ivy

Lars Gyrup Brink Nielsen, Jacob Andresen, Santosh Yadav

Compartir libro
  1. 242 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Accelerating Angular Development with Ivy

Lars Gyrup Brink Nielsen, Jacob Andresen, Santosh Yadav

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Get a comprehensive introduction to the major Angular framework rewrite known as Angular IvyKey Features• Upgrade your Angular applications from traditional View Engine to modern Angular Ivy• Get a detailed walkthrough of the new features and breaking changes in Angular• Explorer new Angular APIs, syntax, tooling, and configurations for modern frontend web developmentBook DescriptionAngular 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.What you will learn• Find out why Angular Ivy tests are faster and more robust• Explore the concept of CSS custom properties and scoping of values and learn how to use them with Angular Ivy• Use testing harnesses present in Angular components to write effective tests• Explore the architecture of the Angular compatibility compiler and understand why it is important• Discover effective techniques for migrating your existing Angular apps to the Ivy engine• Overcome challenges that you might face when switching to AOT compilationWho this book is forThis book is for experienced Angular web developers who want to migrate to the latest Ivy engine for building faster web applications. Intermediate knowledge of Angular and TypeScript will help you get the most out of this book.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Accelerating Angular Development with Ivy un PDF/ePUB en línea?
Sí, puedes acceder a Accelerating Angular Development with Ivy de Lars Gyrup Brink Nielsen, Jacob Andresen, Santosh Yadav en formato PDF o ePUB, así como a otros libros populares de Computer Science y Web Services & APIs. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2021
ISBN
9781800201088
Edición
1

Chapter 1: Discovering New APIs and Language Syntax

As its only officially supported programming language, Angular is tightly coupled with TypeScript. Support for new versions of TypeScript is introduced with major and minor version releases of Angular. In this chapter, we will explore three powerful language features that have been released in the recent versions of TypeScript and Angular:
  • The optional chaining operator (?.)
  • The nullish coalescing operator (??)
  • Native private class members (#)
Through simple examples, we will highlight the strengths of these modern programming language features. We will even learn how two of the new operators work elegantly together in common scenarios. Learning about this new syntax and semantics is key to understanding the examples throughout this book.
Globalization is the process of supporting and adapting multilingual and regional capabilities in an application. Angular Ivy introduces improved globalization APIs. Together, we will learn about localization bundling, directionality querying, and lazy loading locale data through comprehensive examples.
Many core parts of Angular are built with testability in mind. Angular Ivy introduces strongly typed dependency resolving in tests and a fake icon registry for integrated component tests.
In this first chapter, we will cover the following topics:
  • Modernizing your code with powerful language features
  • Optimizing regional support with improved globalization APIs
  • Enhancing tests with stronger types and new APIs
The demo application featured in Part 2, Build a Real-World Application with the Angular Ivy Features You Learned does not use globalization APIs. The tests featured in that part focus on component testing using the new concept component testing harnesses, which will be introduced in Chapter 3, Introducing CSS Custom Properties and New Provider Scopes.
After reading this chapter, you will be able to refactor your existing Angular applications and tests to use modern standards and Angular APIs when developing.

Technical requirements

To support all the features introduced in this chapter, your application requires at least the following:
  • Angular Ivy version 9.1
  • TypeScript version 3.8
You can find the complete code examples for the globalization APIs in this book's companion GitHub repository at https://github.com/PacktPublishing/Accelerating-Angular-Development-with-Ivy/tree/main/projects/chapter1/globalization.

Modernizing your code with powerful language features

TypeScript is an integral part of Angular, but because Angular has its own compiler transformations that extend TypeScript's compilation steps, we are inevitably tied to the version of TypeScript that the Angular compiler supports. Fortunately, Angular is good at keeping up with recent versions of TypeScript. In this section, we are going to discuss some of the most noteworthy additions to the TypeScript language in the most recent versions supported by Angular Ivy.

The optional chaining operator

TypeScript version 3.7 introduces a new operator for optional property access, optional element access, and optional calls. The optional chaining operator (?.) short circuits in the case of nullish values – that is, null or undefined – in which case it evaluates to undefined.
Optional chaining is great for working with composite objects or just plain old complex data structures such as large business documents transferred from a server, a dynamic runtime configuration, or telemetry from Internet of Things (IoT) devices.
The optional chaining operator allows us to be more concise in a single expression that attempts to access a hierarchy of properties that may or may not be available.
Say we are working on a document processing system that supports Universal Business Language (UBL) documents in JSON format. In our UBL invoice parser, we want to determine the UBL version that the document follows to be able to parse it according to a standard version. We fall back to UBL version 2.1 if it's left unspecified.
Without optional chaining, our code might look like this, given an invoice variable containing the invoice document:
const ublVersion =
(invoice.Invoice[0].UBLVersionID &&
invoice.Invoice[0].UBLVersionID[0] &&
invoice.Invoice[0].UBLVersionID[0].I...

Índice