More updates from Angular v18

Angular
13 Jun 202406:03

Summary

TLDRAngular v18 introduces a suite of enhancements aimed at refining web app development. It brings new signal-based APIs, including Signal Inputs and Model Input API, for optimized data binding and two-way synchronization. The release also features Signal Query APIs for reactive, type-safe interactions with content and view children. An experimental preview of Zoneless Angular is included, aiming to make Zone.js optional. Other improvements include TypeScript 5.4 support, default values for ng-content, and a new global observable for Angular Forms. These updates are part of Angular's ongoing commitment to incremental advancements in developer experience.

Takeaways

  • 🎉 Angular v18 has been released with new APIs and features to enhance the development of web applications.
  • 🚀 Introduction of Signal Inputs allows for binding values from a parent component using signals, enabling lifecycle changes.
  • 🔄 The new Model Input API facilitates two-way data binding, allowing components to propagate new values back to their parents.
  • 🔍 Signal Query APIs provide a typesafe, reactive way to interact with ContentChildren and ViewChildren, offering improved type safety and lazier updates.
  • 🌐 Zoneless Angular is now available as an experimental feature, aiming to make Zone.js fully optional for developers.
  • 🛠 Incremental improvements in v18 allow developers to explore removing zones from their code, with eventCoalescing on by default for better scheduling.
  • 📝 TypeScript 5.4 features are now available in Angular applications, including preserved narrowing and the NoInfer utility type.
  • 📌 Developers can provide a default value for ng-content, offering a placeholder for empty lists and components without content.
  • 🗸 Angular Forms introduces a new global observable for tracking changes across any abstract control and its children, including events like touched and dirty.
  • 🔑 Most of these new features were introduced in minor releases, meaning developers don't have to wait for major releases to benefit from enhancements.
  • 📈 The Angular team is actively working on the future of the framework, with more information available on their public roadmap.

Q & A

  • What is the main topic of the video script provided?

    -The main topic of the video script is the release of Angular v18 and its new features, bug fixes, and incremental improvements for building web applications.

  • What are the new APIs introduced in Angular v18 to improve the developer experience?

    -Angular v18 introduces new signal-based APIs, including Signal Inputs, Model Input API, and Signal Query APIs to enhance the developer experience.

  • How do Signal Inputs work in Angular v18?

    -Signal Inputs in Angular v18 allow values to be bound from a parent component and are exposed using a signal, enabling them to change during the lifecycle of the component.

  • What is the purpose of the Model Input API in Angular v18?

    -The Model Input API in Angular v18 enables a component to propagate new values back to another component, providing a typesafe, reactive way to interact with data.

  • How do Signal Query APIs differ from the previous approach for querying ContentChildren and ViewChildren?

    -Signal Query APIs expose query results as signals, allowing them to be composed with other signals and drive change detection, offering benefits like predictable timing, simpler API, improved type safety, and lazier updates.

  • What is the significance of the experimental preview of Zoneless Angular in v18?

    -The experimental preview of Zoneless Angular in v18 is a step towards making Zone.js fully optional, improving the developer experience by allowing Angular to function without relying on Zone.js for change detection.

  • What improvements does Angular v18 offer for developers using TypeScript 5.4 features?

    -Angular v18 allows developers to enjoy the latest features of TypeScript 5.4, including preserved narrowing, enclosures following last assignments, the NoInfer utility type, and more.

  • What is the new feature in Angular v18 that allows developers to provide a default value for ng-content?

    -In Angular v18, developers can now provide a default value for ng-content, enabling placeholders for empty lists and components with no current content.

  • How does the new global observable introduced in Angular Forms help developers track changes?

    -The new global observable in Angular Forms allows developers to subscribe to track changes around any abstract control and its children, including events like touched, dirty, etc., in addition to value and status, all through a single observable.

  • What does the Angular team emphasize regarding the frequency of updates and enhancements?

    -The Angular team emphasizes that most of the new features and enhancements have been introduced in minor releases leading up to v18, meaning developers do not have to wait for major releases to receive updates.

  • How can developers stay informed about the future of Angular and its ongoing developments?

    -Developers can stay informed about the future of Angular and its ongoing developments by visiting the public roadmap at angular.dev/roadmap and checking the full changelog on GitHub for each feature, fix, and enhancement in v18.

Outlines

00:00

🚀 Angular v18: New Features and APIs

Emma Twersky introduces Angular v18, highlighting its new APIs and features aimed at enhancing the developer experience. The release includes signal-based APIs, which were introduced in v17, to optimize rendering updates. New additions are Signal Inputs for binding values from a parent component, the Model Input API for two-way data binding, and the Signal Query APIs for type-safe reactive interactions with ContentChildren and ViewChildren. These APIs allow for more predictable timing, simpler API usage, improved type safety, and lazier updates. The paragraph also mentions an experimental preview of Zoneless Angular, aiming to make Zone.js optional, and the benefits of the Zoneless Scheduler in existing apps. Angular Material components and the CDK are now zoneless-compatible.

05:01

🔧 Angular v18: Incremental Improvements and TypeScript 5.4

The script continues to detail incremental improvements in Angular v18, such as the ability to use TypeScript 5.4 features within applications, including preserved narrowing, enclosures following last assignments, and the NoInfer utility type. Developers can now provide a default value for ng-content, offering a placeholder for empty lists and components without content. Additionally, Angular Forms introduces a new global observable to track various events like touched, dirty, and status changes, in addition to value changes, through a single observable. The paragraph emphasizes that many of these features were implemented in minor releases, allowing for more frequent updates without waiting for major releases. It encourages users to check the public roadmap and GitHub changelog for more information on ongoing developments and updates.

Mindmap

Keywords

💡Angular v18

Angular v18 refers to the latest major version of the Angular framework, a platform for building dynamic web applications. In the video, it is the central topic as it introduces new features, improvements, and bug fixes that enhance the developer experience and the capabilities of web apps. The script highlights Angular v18's new APIs and its journey towards signal-based components.

💡Signal-based APIs

Signal-based APIs in Angular v18 are a set of features designed to improve the developer experience by allowing more granular tracking of state usage throughout an application. They enable the framework to optimize rendering updates. The script mentions the introduction of Signal Inputs and Model Input API as part of these APIs, which are crucial for the development of signal-based components.

💡Signal Inputs

Signal Inputs are a new feature in Angular v18 that allows values to be bound from a parent component and exposed using a signal. This means that the values can change dynamically during the component's lifecycle, providing a reactive way to handle data changes. The script illustrates this by explaining how developers can bind values and have them change reactively.

💡Model Input API

The Model Input API is introduced as a special type of input in Angular v18 that enables components to propagate new values back to another component. It is similar to Standard Inputs but allows the component author to write values into the property. This API is significant for two-way data binding and keeping data in sync, as demonstrated in the script.

💡Signal Query APIs

Signal Query APIs are a new approach in Angular v18 that exposes query results as signals. This allows developers to interact with ContentChildren and ViewChildren in a typesafe and reactive manner within templates. The script explains that these APIs enable query results to be composed with other signals, driving change detection and offering improved type safety and lazier updates.

💡Zoneless Angular

Zoneless Angular is an experimental feature in Angular v18 that aims to make the use of Zone.js fully optional, improving the developer experience by allowing change detection to be scheduled even when changes happen outside the Angular Zone. The script discusses the future of Angular without Zones and how Angular Material components and the CDK are compatible with this approach.

💡TypeScript 5.4

TypeScript 5.4 is the latest version of TypeScript mentioned in the script, which is a superset of JavaScript that adds static types. Angular v18 supports the latest features of TypeScript 5.4, allowing developers to take advantage of new language features such as preserved narrowing, enclosures following last assignments, and the NoInfer utility type.

💡ng-content

ng-content is a directive in Angular used for projecting external content into a component's view. The script mentions a new feature in Angular v18 that allows developers to provide a default value for ng-content, enabling placeholders for empty lists or components with no current content.

💡Angular Forms

Angular Forms is a module in Angular that provides a set of abstractions for handling forms in Angular applications. The script highlights a new global observable introduced in Angular Forms that allows developers to track changes around any abstract control and its children, providing a unified way to monitor various form events.

💡ng-update

ng-update is a command-line utility in Angular that helps developers update their applications to the latest version of Angular. The script encourages developers to use ng-update to take advantage of the new features, fixes, and enhancements in Angular v18.

💡GitHub

GitHub is a platform for version control and collaboration that is widely used by developers. In the context of the script, GitHub is mentioned as the place where developers can find the full changelog for Angular v18, detailing every feature, fix, and enhancement included in the release.

Highlights

Angular v18 introduces new APIs to improve the developer experience.

New signal-based APIs are included for optimized rendering updates.

Signal Inputs allow parent component values to be bound and change over the component's lifecycle.

Model Input API enables components to propagate new values back to another component.

Model Inputs are defined similarly to Standard Inputs but allow writing values into the property.

Signal Query APIs provide a typesafe, reactive way to interact with ContentChildren and ViewChildren in templates.

Signal-based query system offers benefits like predictable timing, simpler API, improved type safety, and lazier updates.

The underlying query mechanism remains largely unchanged, but the result type and timing have been refined.

Zoneless Angular is introduced as an experimental preview, aiming to make Zone.js fully optional.

v18 includes incremental improvements for exploring the removal of zones in code.

Event coalescing is enabled by default in v18, using the same scheduler as Zoneless Angular.

Angular Material components and the CDK are now zoneless-compatible.

Developers can enjoy the latest features of TypeScript 5.4 in their Angular applications.

A default value can now be provided for ng-content, offering placeholders for empty components.

Angular Forms introduces a new global observable for tracking various control events through a single observable.

Most of these features were introduced in minor releases, allowing for quicker enhancements and fixes.

Angular's public roadmap provides insights into the ongoing development and future plans.

ng-update and the GitHub changelog offer comprehensive details on features, fixes, and enhancements in v18.

Transcripts

play00:00

EMMA TWERSKY: Angular v18 is here.

play00:02

And besides the big updates, there

play00:04

are a lot of great little features, bug fixes,

play00:07

and incremental improvements to help you

play00:09

and your teams build the next generation of web apps.

play00:12

Emma here from the Angular team, and I'm

play00:14

going to tell you about the great features launched

play00:17

in this release.

play00:18

Let's do this.

play00:20

[MUSIC PLAYING]

play00:22

Angular v18 is shipping with new APIs

play00:25

to further improve the developer experience in the framework.

play00:29

First up are our new signal-based APIs.

play00:33

In v17, we introduced Angular Signals,

play00:36

a system that granularly tracks how and where your state is used

play00:41

throughout an application, allowing the framework

play00:44

to optimize rendering updates.

play00:46

Now we're on a path to fully signal-based components,

play00:50

and this release contains some of the building blocks

play00:53

developers will need to make that happen.

play00:56

First, we're introducing Signal Inputs.

play01:00

Signal Inputs allow values to be bound from a parent component.

play01:04

Those values are exposed using a signal

play01:07

and can change during the lifecycle of your component.

play01:11

To help developers have a better time keeping data in sync

play01:15

with two-way binding, there's the new Model Input API.

play01:20

Model Inputs are a special type of input

play01:23

that enable a component to propagate new values back

play01:26

to another component.

play01:28

When creating a component, you can define a Model Input

play01:31

similarly to how you create a Standard Input.

play01:35

Both types of inputs allow someone

play01:37

to bind a value into the property.

play01:40

However, Model Inputs allow the component author to write values

play01:44

into the property.

play01:45

In other respects, you can use Model Inputs the same way

play01:49

you use Standard Inputs.

play01:51

We know that developers have long

play01:53

wanted a typesafe, reactive way to interact with ContentChildren

play01:57

and ViewChildren in templates.

play02:00

We heard you loud and clear, and that's

play02:02

why we've built the new Signal Query APIs.

play02:06

The new approach exposes query results

play02:08

as signals, which mean that query results can

play02:11

be composed with other signals using computed or effect

play02:15

and drive change detection.

play02:18

Additionally, the signal-based query system

play02:20

offers other benefits, like more predictable timing,

play02:23

simpler API surface, improved type safety, more accurate type

play02:29

inference, and lazier updates.

play02:32

The underlying query mechanism doesn't change much.

play02:35

Conceptually, Angular still creates singular child or plural

play02:39

children queries that target elements in a template

play02:43

or content.

play02:44

The difference is in the type of result

play02:47

and the exact timing of the result availability.

play02:49

These features bring v18 closer to our goal

play02:53

of signal-based components, but we're not stopping there.

play02:57

As Alex shared, v18 includes an experimental preview

play03:01

of Zoneless Angular.

play03:03

He did a great job sharing how we're

play03:05

thinking about the future developer experience of Zoneless

play03:07

Angular and why our eventual goal is

play03:10

to make Zone.js fully optional.

play03:14

But we know that you want to see some code.

play03:17

v18 includes some incremental improvements

play03:19

that allow you to explore removing zones in your code

play03:23

starting today.

play03:25

Zone's eventCoalescing is on by default in v18,

play03:29

and zoneCoalescing uses the same scheduler as Zoneless.

play03:35

Angular with Zone.js can be configured

play03:37

to schedule change detection even when the changes happen

play03:41

outside the Angular Zone.

play03:43

This takes advantage of the Zoneless Scheduler

play03:45

in existing Zone.js apps.

play03:48

And Angular Material components and the CDK

play03:51

are zoneless-compatible.

play03:54

Zoneless is available as experimental in v18.

play03:58

To learn more about experimental Zoneless

play04:00

support, head to our guides on angular.dev.

play04:04

But that's not it.

play04:06

Here are some quick hits that are

play04:08

sure to make developing in Angular better.

play04:11

Developers can enjoy the latest features of TypeScript 5.4

play04:15

in your applications.

play04:17

Update now for preserved narrowing

play04:19

enclosures following last assignments, the NoInfer utility

play04:23

type, and a lot more.

play04:26

You can learn more about what these

play04:29

all mean in Microsoft's blog post announcing TypeScript 5.4.

play04:34

Also new, developers can now provide a default value

play04:38

for ng-content.

play04:40

This allows you to have a placeholder for empty lists

play04:44

and other components with no current content.

play04:47

And what's that?

play04:48

We've closed our number one most upvoted

play04:51

feature request on GitHub.

play04:54

Angular Forms introduced a new global observable

play04:57

you can subscribe to to track changes

play05:00

around any abstract control and its children.

play05:04

You can now track all kinds of events, like touched, dirty, et

play05:09

cetera, in addition to value and status,

play05:12

all through a single observable.

play05:15

You know what's even cooler?

play05:17

Most of these featurettes actually

play05:19

happened in a minor release leading up to today.

play05:22

That means you don't have to wait

play05:24

six months for the next enhancement to your Signal APIs,

play05:27

another step towards Zoneless, or one of your top-voted issues

play05:31

being resolved.

play05:33

We've been talking a lot about the future of Angular,

play05:36

and you can find out more about what we've been working

play05:39

on by heading over to our public roadmap at angular.dev/roadmap.

play05:45

Be sure to ng-update and check out our full changelog

play05:49

on GitHub for each and every feature, fix,

play05:52

and enhancement in v18.

play05:55

[MUSIC PLAYING]

Rate This

5.0 / 5 (0 votes)

Related Tags
Angular v18Web DevelopmentSignal InputsModel Input APISignal QueriesZoneless AngularTypeScript 5.4ng-contentAngular FormsFeature UpdatesDeveloper Experience