What's new in Angular

Chrome for Developers
16 May 202439:18

Summary

TLDRIn the 'What's New in Angular' session, Minko Gechev, Jessica Janiuk, and Jeremy Elbourn discuss the latest advancements in Angular, focusing on improving developer experience and application performance. They introduce new APIs for building components with Signals, enhancements to developer tooling, and optimizations in the build system with esbuild. The session also covers partial hydration for faster loading, the new Angular logo, and the refreshed documentation site at Angular.dev. They highlight community contributions and explore future possibilities like full zoneless, hot module replacement, and component authoring enhancements.

Takeaways

  • 🎉 Angular has been undergoing a renaissance with significant updates and improvements, leading to a resurgence in community interest and usage.
  • 🚀 The team has shipped deferrable views, which were highly requested and are now available for developers to enhance their applications.
  • 🔄 Angular has also introduced a new control flow syntax, shipped in Angular version 17, aiming to simplify and streamline development processes.
  • 🌐 Support for Material 3 has been added in Angular Material, with a corresponding blog post for developers to learn more.
  • 📈 Angular Signals have been successfully implemented in YouTube's mobile web traffic, showcasing a significant performance improvement and a major step towards a more reactive framework.
  • 🤝 Angular and Wiz, a Google internal web framework, have started collaborating, leading to shared codebases and a stronger focus on performance.
  • 🛠️ New APIs for building Angular components and directives with Signals are now available in Developer Preview, offering a cleaner and more efficient coding experience.
  • 📱 Performance optimizations have been a key focus, with improvements to the Angular's optimized image directive and the introduction of partial hydration for faster load times.
  • ⚙️ Developer tooling has been enhanced, including improved type narrowing in templates, inspection of the application injector tree, and diagnostics to catch common issues.
  • 🔧 The Angular CLI has been updated with new features such as automated refactoring to the new control flow syntax and support for new component authoring patterns.
  • 🌟 The Angular team is looking towards the future with plans for full zoneless support, hot module replacement, streaming server-side rendering, and further enhancements to component authoring.

Q & A

  • What is the Angular renaissance mentioned in the script?

    -The Angular renaissance refers to the renewed interest and positive feedback from the community due to the continuous improvements and new features being introduced in Angular, such as deferrable views, new control flow syntax, and support for Material 3.

  • What are deferrable views in Angular?

    -Deferrable views is a feature that was shipped in Angular, which allows developers to load parts of their application on demand, improving the performance of their web apps by reducing initial load time.

  • What was the purpose of the request for comments (RFC) on deferrable views and the new control flow syntax?

    -The RFCs were published to gather feedback from the developer community before implementing these features. This helped shape the final implementation of deferrable views and the new control flow syntax in Angular.

  • How does Angular's collaboration with Wiz impact performance?

    -The collaboration between Angular and Wiz has led to the adoption of Angular Signals, which are now in production for 100% of YouTube's mobile web traffic, improving interaction latency and frame rates on various Google products.

  • What are Angular Signals primitives?

    -Angular Signals primitives are a reactive programming feature that allows for more efficient rendering and state management in Angular applications. They are now being used in YouTube's mobile web traffic, leading to significant performance improvements.

  • What is the status of Signals as a JavaScript language standard feature?

    -Signals have reached stage 1 in the JavaScript Standardization Committee, TC39, indicating that they are being considered for inclusion as a standard feature in the JavaScript language.

  • What are the new Signal-based query APIs in Angular?

    -The new Signal-based query APIs in Angular provide a Signal of query results for Angular APIs like ViewChild and ContentChildren. They offer a more concise and consistent way to work with query results and improve type inference.

  • What is the difference between Signal inputs and traditional inputs in Angular?

    -Signal inputs in Angular are based on the reactive programming model and provide a Signal for input properties. They simplify patterns where developers inspect input values for changes and are read-only to ensure clarity on the state's origin.

  • Why are outputs in Angular not signal-based?

    -Outputs in Angular are not signal-based because they work the same way they always have, using event emitters. The decision to keep outputs as they are aims to maintain consistency and simplicity in event handling within Angular components and directives.

  • What is the new model for two-way binding in Angular using Signals?

    -The new model for two-way binding in Angular using Signals provides a writeable signal that allows updating values directly, which then propagates changes back through two-way bindings. This simplifies the process compared to the traditional input and output approach.

  • What improvements has Angular made to its developer tooling?

    -Angular has improved its developer tooling by leveraging the Angular compiler for catching common issues, introducing inspection of application injector trees, and enhancing type narrowing in templates with the new control flow syntax.

  • What is the significance of the new Angular logo and the rebranding?

    -The new Angular logo and rebranding reflect a more future-looking direction for the framework. It's accompanied by a new documentation site at Angular.dev, which modernizes the documentation experience and adds useful features like an interactive Getting Started tutorial.

  • What are some of the future plans mentioned for Angular?

    -Some of the future plans for Angular include full zoneless support, hot module replacement, streaming server-side rendering, and enhancements to component authoring to simplify the development experience.

  • What is the concept of partial hydration in Angular?

    -Partial hydration is a technique that allows for a more efficient loading of JavaScript by only loading the necessary parts to handle user interactions with specific parts of the page. This can reduce initial bundle sizes and improve Core Web Vitals.

  • How does the JSAction library support partial hydration in Angular?

    -JSAction, a library originally created by the Wiz team, supports partial hydration by capturing and queuing user interactions that occur while the page is hydrating. These interactions are then replayed once hydration is complete, ensuring no user actions are lost.

  • What is the significance of the collaboration between Angular and Firebase teams?

    -The collaboration between Angular and Firebase teams aims to make Firebase App Hosting the new home for Angular apps, providing support for server-side rendering, client rendering, and pre-rendering, thus enhancing deployment options for Angular applications.

  • What is the new approach to component authoring that Angular is considering?

    -Angular is considering a new approach to component authoring that removes the need for component selectors, allowing developers to reference components directly using symbols from JavaScript module imports. This aims to simplify the component authoring experience and reduce boilerplate code.

Outlines

00:00

🚀 Angular Renaissance and New Features

The video starts with Minko Gechev, Jessica Janiuk, and Jeremy Elbourn introducing the 'What's New in Angular' session. They discuss the term 'Angular renaissance' and attribute it to the team's recent work. Jessica and Jeremy highlight the release of deferrable views, a new control flow syntax, support for Material 3, and new signal APIs in Angular. They emphasize the mission to help developers build web apps with confidence by making Angular faster, more tool-oriented, and stable. The session promises to cover new Angular features for effective web app development and shares exciting news about Angular's future, particularly the development and adoption of Angular Signals with YouTube.

05:01

🌟 Angular Signals and Performance Improvements

The speakers delve into Angular Signals, explaining how they meet YouTube's platform requirements for supporting various browsers and devices. They discuss the compact size of Signals, which is crucial for mobile web traffic on slow networks, and their performance in synthetic benchmarks. YouTube's projects with Signals have shown significant performance gains, including a 35% improvement in interaction latency on lower-end devices and a consistent 60 frames per second interaction. The team also found Signals to simplify framework concepts and lead to more maintainable code. YouTube aims to power all web apps with Signals within two years, marking a successful collaboration between Angular and Wiz teams. The conversation also touches on the advocacy for Signals as a JavaScript language standard feature in TC39.

10:01

🛠️ New Angular APIs and Developer Experience

Jeremy Elbourn introduces new APIs in Angular that are designed to work with Signals, aiming to simplify component and directive creation. The new Signal-based query APIs provide a cleaner and more concise way to handle queries like ViewChild and ContentChildren. Input Signals are highlighted as a way to simplify reactive inputs and computed expressions. Outputs are discussed, clarifying that they are not signal-based but have been updated for consistency with the new APIs. Model inputs are introduced as a simpler approach to two-way binding, providing a writeable signal for state synchronization. The Angular compiler is leveraged to catch common issues, and new debugging tooling is introduced for better developer experience.

15:01

🔧 Towards a Zoneless Angular and RxJS Integration

The discussion moves towards making Angular 'zoneless' and the efforts to make RxJS optional for new Angular applications. While the new signal APIs are a significant step, there's more work to streamline the experience, particularly with task scheduling and change detection. The team is also working on interop APIs for Angular and RxJS, allowing for better integration and more fluent use of RxJS. The new output API is highlighted as an example of removing strict dependency on RxJS while providing functions to use it effectively.

20:04

🎨 Improving Angular Templating and Control Flow

Jessica Janiuk talks about improvements in Angular's templating and control flow syntax. The team conducted user studies and received feedback that led to the proposal of a new control flow syntax in an RFC. The new syntax, which is more intuitive and closer to JavaScript, has been well-received and allows for better type narrowing. The Angular CLI can automatically refactor code to the new syntax. Additionally, improvements to the list diffing algorithm have resulted in performance boosts, as reported by bill.com.

25:05

⚡️ Performance Optimizations and Lazy Loading

Jeremy Elbourn discusses various performance optimizations in Angular, including the optimized image directive, which has seen improvements in image placeholders, preconnect links, and preload hints for SSR. The directive has led to significant Core Web Vitals improvements in e-commerce platforms. Declarative lazy loading and prefetching of code have been shipped in Angular 17, allowing for on-demand loading of template parts and reducing bundle sizes, as experienced by bill.com. Hybrid rendering, a combination of client-side, pre-rendering, or server-side rendering, has seen increased adoption and contributed to performance improvements.

30:08

🔄 Adoption of Hybrid Rendering and esbuild Integration

The session highlights the increased adoption of hybrid rendering, as seen in the HTTP archive, and its benefits, such as a 72% reduction in largest contentful paint reported by Virgin Media O2. The improvements to Angular CLI's build system with esbuild are discussed, showcasing how esbuild is integrated into the build pipeline to speed up the build process. Vanguard reported a three times speed improvement with esbuild. Angular 17 makes esbuild the default, and a migration schematic is available for existing applications.

35:09

💧 Partial Hydration and Collaboration with Wiz

Jeremy Elbourn introduces partial hydration, a technique that can improve web applications by reducing initial bundle sizes and total blocking time. Partial hydration, inspired by Wiz's approach, loads only a thin event handling layer and downloads JavaScript on-demand for specific page interactions. This is contrasted with full-page hydration, which loads all JavaScript eagerly. The session also discusses the collaboration with the Wiz team and how Angular applications are benefiting from Wiz's expertise with JSAction, a library that captures and replays user interactions during hydration.

🌐 Community Innovations and Angular's Future Direction

The final paragraph covers community-driven innovations in the Angular ecosystem, including state management libraries with signal support and the release of analog JS, a meta-framework offering an alternative component authoring format. The Angular team also discusses future plans, such as full zoneless support, hot module replacement, streaming server-side rendering, and component authoring enhancements. They hint at a potential change to the component authoring experience by removing the need for selectors and standalone flags, streamlining the process. The team emphasizes their mission to help developers deliver web apps with confidence and invites viewers to explore the new features on Angular.dev.

Mindmap

Keywords

💡Angular

Angular is an open-source web application framework led by the Angular Team at Google and by a community of individuals and corporations. In the video's context, Angular is the main subject, with discussions around its updates, performance improvements, and new features that are aimed at helping developers build web applications more efficiently. The video script mentions Angular in various instances, such as Angular Signals, Angular Material, and the Angular CLI, highlighting its significance throughout the discussion.

💡Deferrable Views

Deferrable Views is a feature in Angular that allows parts of a web application to be loaded on demand rather than all at once. This can lead to performance improvements by reducing the initial load time. In the script, it is mentioned that Angular has shipped deferrable views, and developers are now enjoying this feature in their apps, which is part of the broader theme of performance optimization discussed in the video.

💡Signals

Signals in the context of Angular refer to a new primitive for state management that is reactive and can lead to better performance and more maintainable code. The script discusses Angular Signals and how they have been implemented in production for YouTube's mobile web traffic, indicating a significant advancement in Angular's capabilities for building reactive and high-performance web applications.

💡Control Flow Syntax

Control Flow Syntax in Angular templates refers to the way developers write the structure of their application's user interface. The script mentions that Angular has introduced a new control flow syntax, which is a major change aimed at making it more intuitive and closer to JavaScript, thus improving developer experience and productivity.

💡Hybrid Rendering

Hybrid Rendering is a technique that combines client-side rendering, pre-rendering, or server-side rendering to optimize web application performance. The script discusses the adoption of hybrid rendering in Angular and its benefits, such as a significant reduction in largest contentful paint, showcasing Angular's commitment to performance enhancements.

💡Angular CLI

The Angular CLI is a command-line interface tool that is used to initialize, develop, scaffold, and maintain Angular applications. In the script, the Angular CLI is mentioned in various contexts, such as the introduction of new APIs, build optimizations, and the ability to refactor code to the new control flow syntax, emphasizing its role in streamlining the development process.

💡Developer Tooling

Developer Tooling refers to the tools and features that assist developers in creating, debugging, and maintaining their applications. The script discusses improvements in Angular's developer tooling, such as the Angular compiler's extended diagnostics and the Component Explorer in the Angular DevTools, which help developers write safer and more efficient code.

💡Performance Optimization

Performance Optimization is the process of improving the speed, efficiency, and overall performance of a web application. The script frequently discusses performance optimization in Angular, with mentions of improved image directives, list diffing algorithms, and the benefits of using deferrable views and hybrid rendering.

💡JSAction

JSAction is a library that enables partial hydration in web applications by capturing and replaying user interactions that occur during the hydration process. The script explains how Angular is using JSAction to improve the hydration process, allowing for more efficient loading of JavaScript and a better user experience.

💡TanStack

TanStack is a set of libraries for building user interfaces, which has been integrated into the Angular ecosystem. The script mentions TanStack's query and store libraries, as well as the introduction of support for TanStack forms, indicating the growing support for third-party libraries in Angular and the expanding options for developers.

💡Component Authoring

Component Authoring in Angular refers to the process of creating and defining Angular components. The script discusses potential enhancements to the component authoring experience, such as removing the need for component selectors and simplifying the process with direct references to JavaScript symbols, which aims to reduce boilerplate code and improve developer efficiency.

Highlights

Angular team has been experiencing a renaissance with significant updates and improvements.

Deferrable views have been shipped, enhancing developer experience.

Angular version 17 introduced a new control flow syntax, simplifying template expressions.

Support for Material 3 has been added in Angular Material.

New signal APIs for components and directives have been shipped to improve reactivity.

Angular CLI and dev tools have received updates across components, documentation, and lifecycle hooks.

Angular's mission is to help developers ship web apps with confidence by building faster and more stable apps.

Angular Signals primitives are now in production for 100% of YouTube's mobile web traffic.

YouTube's collaboration with Angular and Wiz has led to significant performance improvements.

The JavaScript Standardization Committee TC39 is considering Signals as a language standard feature.

New APIs for building Angular components with Signals are available in Developer Preview.

The Angular compiler now helps catch common issues with extended diagnostics for templates.

The new control flow syntax in Angular templates has been improved for better readability and performance.

Bill.com reported a one-second improvement in their largest contentful paint after adopting the new control flow.

Angular's optimized image directive has been enhanced for better Core Web Vitals.

Declarative lazy loading and prefetching of code have been introduced to improve performance.

Hybrid rendering in Angular has seen increased adoption, leading to significant performance improvements.

Angular CLI's build system has been improved with esbuild, offering faster build times.

Vite integration with Angular's dev server provides faster development cycles with custom response resolution.

Partial hydration, a technique to reduce initial bundle sizes, is being prototyped for future Angular releases.

Firebase App Hosting now supports Angular apps with server-side rendering, client rendering, and pre-rendering.

Angular's documentation site has been revamped with a new interactive Getting Started tutorial.

The Angular team is exploring component authoring enhancements, including the possibility of selectorless components.

Angular introduced a new logo and a modernized documentation site at Angular.dev.

Transcripts

play00:00

[MUSIC PLAYING]

play00:05

MINKO GECHEV: All right.

play00:06

Hello, everyone, and welcome to "What's New in Angular."

play00:09

I'm Minko Gechev, the Product and DevRel lead on Angular.

play00:13

JESSICA JANIUK: And I'm Jessica Janiuk a Senior Software

play00:15

Engineer on Angular.

play00:17

JEREMY ELBOURN: And I'm Jeremy Elbourn, Tech Lead for Angular.

play00:20

MINKO GECHEV: So you two, I've been hearing a lot--

play00:22

the community is talking about this Angular renaissance.

play00:24

And now, I know we have a lot of talented people on the team.

play00:27

Have we been getting more into arts and literature?

play00:30

JEREMY ELBOURN: You know, Minko, I

play00:31

think people have been saying that because--

play00:33

JESSICA JANIUK: We've been shipping.

play00:35

MINKO GECHEV: What have you been shipping?

play00:37

JESSICA JANIUK: Well, we shipped deferrable views.

play00:39

JEREMY ELBOURN: That's right.

play00:40

Last year, we published a request for comments

play00:42

on deferrable views and developers

play00:44

are now enjoying it in their apps.

play00:46

[APPLAUSE]

play00:48

MINKO GECHEV: Yeah, and that's not the only RFC,

play00:50

or Request For Comment, that we published last year.

play00:53

JESSICA JANIUK: We also published

play00:54

an RFC for the new control flow syntax last year

play00:57

and we shipped that in Angular version 17.

play01:00

[APPLAUSE]

play01:03

JEREMY ELBOURN: We also recently shipped support for Material 3

play01:06

in Angular Material.

play01:08

MINKO GECHEV: And there is a blog post about it, so make sure

play01:11

you check blog.angular.io.

play01:14

JESSICA JANIUK: And we also shipped new signal APIs

play01:16

for components and directives.

play01:19

[APPLAUSE]

play01:21

MINKO GECHEV: And we shipped so much more

play01:23

across the Angular CLI, Angular dev tools, components,

play01:27

documentation, lifecycle hooks.

play01:29

And this just goes on and on.

play01:32

JEREMY ELBOURN: And everything that we are shipping

play01:34

is in service of our mission to help developers like you

play01:37

ship web apps with confidence.

play01:39

And we're doing that by making it easier to build faster apps.

play01:43

We're doing that by giving you tools to build apps faster.

play01:47

And we're doing that by keeping Angular as stable and reliable

play01:50

as possible.

play01:51

During this session, we're going to talk

play01:53

about all of the new Angular features

play01:55

that you can use to more effectively build and ship

play01:58

web apps.

play01:59

MINKO GECHEV: But first, we're going

play02:01

to share some very exciting news about the future of Angular.

play02:05

JESSICA JANIUK: So as most of you know,

play02:07

the team has spent a lot of time working on Signals.

play02:11

It was just less than one year ago that we published

play02:13

our request for comments for Angular Signal,

play02:15

and we got an incredible community response with over

play02:19

1,000 comments.

play02:20

So clearly, there was a lot of interest.

play02:23

But it turned out there was more interest

play02:26

than just in the Angular community and something

play02:28

we didn't predict happened.

play02:31

Google actually has another web framework called Wiz.

play02:35

And Wiz is not an open source framework.

play02:38

It's internal specifically to Google,

play02:41

and it's actually very tightly coupled

play02:42

to Google's internal tech stack, which

play02:45

is pretty different from what's popular out in the open source

play02:48

world.

play02:49

Wiz is hyper focused on performance above all else,

play02:54

and this is why many of Google's biggest flagship consumer

play02:57

products are built with Wiz, like Search, Chat, Meet, Photos,

play03:02

Play, and more.

play03:04

JEREMY ELBOURN: Yeah, and Angular and Wiz

play03:06

have both existed in some form or another for over 10 years.

play03:10

And in the beginning, the types of UI

play03:12

that developers would build with these two different frameworks

play03:15

were also rather different.

play03:16

Wiz applications tended to be more consumer focused

play03:19

for products that were really latency sensitive

play03:22

and Angular applications were much more interactive,

play03:25

a lot of overlap with what people would commonly

play03:27

call enterprise UIs.

play03:29

But we saw that over time the lines between these two

play03:32

types of UI started to blur.

play03:34

Wiz developers inside of Google started

play03:37

wanting more features Angular, and Angular developers

play03:40

both inside and outside of Google,

play03:42

wanted more performance-oriented features like Wiz.

play03:45

And it became clear that the two frameworks were converging

play03:49

on a lot of the same ideas, and people inside of Google

play03:52

started to ask, why are we duplicating so much work

play03:54

between these frameworks?

play03:56

JESSICA JANIUK: And so last year, the stars aligned

play03:59

and we struck upon some serendipity.

play04:01

Just as we were building out our Signal primitives,

play04:04

Wiz was actually looking at doing the exact same thing.

play04:07

And even better, there was a product team

play04:10

that was super enthusiastic to collaborate

play04:13

on an initial version and get something

play04:15

running in production on a pretty aggressive timeline.

play04:19

JEREMY ELBOURN: So with an aggressive timeline like that,

play04:21

it must have been like a pretty small product, right?

play04:24

JESSICA JANIUK: Yeah, it's super tiny.

play04:26

Maybe some of you have heard of it.

play04:29

MINKO GECHEV: So today, Angular Signals primitives

play04:33

are in production for 100% of the YouTube's mobile web

play04:37

traffic.

play04:38

[APPLAUSE]

play04:43

YouTube has been collaborating with both Angular and Wiz

play04:45

for a better part of a year now on the development and adoption

play04:48

of Angular Signals.

play04:49

And YouTube is currently in one of their biggest migrations

play04:53

ever to Wiz, which is going to introduce a reactive rendering

play04:58

for their whole application that is based entirely

play05:00

on Angular Signals.

play05:01

Now, we can dive a little bit deeper

play05:03

to look into how YouTube uses Angular Signals.

play05:07

First, Signals, they meet all the prerequisites

play05:10

of YouTube's platforms.

play05:12

They need to support many different browsers and devices,

play05:15

for instance, all the way from shorts, running them on mobile,

play05:19

to running web apps on smart TVs with YouTube Living Room.

play05:24

The mondo size of Signals is also pretty small,

play05:27

and this meets the requirements for YouTube's mobile web

play05:30

traffic, where most of the users are actually on a pretty

play05:33

slow network connection.

play05:34

And it tops every single synthetic benchmark

play05:37

that the YouTube team came up with.

play05:43

So the YouTube, they kicked off some projects

play05:45

to answer big questions.

play05:46

For example, are the performance gains of Signals,

play05:49

are they at least scalable?

play05:51

Can we scale them with large, messy codebases?

play05:55

Can existing problems be modeled with Signals

play05:58

in a reasonably natural way?

play06:00

And do Signals lead to better code?

play06:02

The YouTube team, they rewrote large part of their UI

play06:06

and they focused on things that were pretty

play06:08

challenging and representative, and the results actually

play06:11

exceeded their expectations.

play06:13

JEREMY ELBOURN: Yeah, and it has gone really well.

play06:16

On lower-end devices, the YouTube team

play06:18

has observed a 35% improvement to interaction latency

play06:23

on Living Room as you're navigating through video tiles.

play06:28

On the video player controls, the change

play06:32

brought all key interactions to a consistent 60 frames

play06:36

per second with relatively minimal

play06:38

effort, up from an occasionally jittery 25 frames

play06:41

per second based on YouTube's legacy

play06:43

virtual DOM-based rendering model.

play06:47

Shorts also reached 60 frames per second and lower interaction

play06:51

latency during swiping, which meaningfully increases top line

play06:54

metrics, like views and watch time.

play06:58

JESSICA JANIUK: So reviewing the new Signal-based code,

play07:00

the team concluded that they preferred the new reactive

play07:03

rendering model, and there were a few main reasons for that.

play07:06

Number one, it was easier to achieve high performance.

play07:10

Often, developers really didn't have to think about performance

play07:12

at all.

play07:13

Usually, the idiomatic way to do something

play07:15

was also the fastest way, even for complex UIs like the three

play07:19

we just mentioned.

play07:22

Number two is that Signals simplify framework concepts

play07:25

related to the virtual DOM, like memoization, stale closures,

play07:29

unexpected rerenders, and rules of hooks.

play07:33

And number three, sometimes it was actually

play07:35

easier to model infrastructure, although sometimes it

play07:39

was harder because the YouTube engineers had to think more

play07:42

about their Dataflow.

play07:44

But the resulting code was usually something

play07:46

that they considered more maintainable.

play07:49

In all, they credit much of that viability

play07:52

to some of the modern Signals features that they just

play07:54

hadn't seen before, like auto tracking, automatic cleanups,

play07:58

and dynamic dependencies.

play08:01

YouTube is already running hundreds

play08:03

of these components in production,

play08:05

and the YouTube team is hoping to power

play08:07

all of YouTube web apps with Signals over the next two years.

play08:12

This collaboration with YouTube has

play08:14

been a huge success for both Angular and the Wiz team,

play08:18

and this project established a great model

play08:20

for our ongoing collaboration between our teams.

play08:23

And going forward, Angular and Wiz

play08:25

are going to be working together much more closely

play08:27

and sharing even more code.

play08:29

Working together in this way is going

play08:32

to help us year after year continue making Angular better

play08:35

for everyone.

play08:36

MINKO GECHEV: All right.

play08:37

So it seems like Signals, they work pretty well

play08:39

for Angular and Wiz.

play08:41

Is there anything we can do to introduce Signals to the broader

play08:44

JavaScript ecosystem?

play08:46

JESSICA JANIUK: Well, the Angular and Wiz teams

play08:48

have been involved with even broader conversations

play08:50

with the web ecosystem experts to advocate for Signals

play08:54

as a JavaScript language standard

play08:56

feature in the JavaScript Standardization Committee, TC39,

play09:00

and as of a couple of weeks ago, they're now actually at stage 1.

play09:05

[APPLAUSE]

play09:12

The reference implementation of Signals

play09:15

is based on Angular Signals because they've actually

play09:17

already proved their efficiency at scale with YouTube.

play09:20

MINKO GECHEV: Now, after hearing all this news about Signals,

play09:23

you probably can't wait to hear more about how you can use

play09:26

Signals in your applications.

play09:27

JEREMY ELBOURN: Well, we've got good news for you

play09:29

because there's a slew of new APIs

play09:32

that have landed in Angular that are ready for you

play09:34

to use in your code.

play09:36

We're going to talk about four types of new APIs

play09:39

today for building your Angular components

play09:41

and directives with Signals.

play09:43

All of these APIs are available now in Developer Preview.

play09:47

The first API we're going to talk about

play09:49

are the new Signal-based query APIs.

play09:52

And when I say queries, I'm talking

play09:54

about Angular APIs, like ViewChild and ContentChildren

play09:57

that if you've used Angular before,

play09:59

you've probably used these.

play10:00

And you may also have felt that these were a little bit verbose.

play10:04

MINKO GECHEV: Yeah, Jeremy, this type here, it barely

play10:06

even fits on the slide.

play10:07

JEREMY ELBOURN: Yeah, so maybe we can do better.

play10:09

And let's take a look at the new APIs based on Signals.

play10:13

MINKO GECHEV: Definitely way cleaner, way shorter.

play10:15

JEREMY ELBOURN: Yeah, shorter, easier to read.

play10:17

These new APIs now give you a Signal of your query results,

play10:20

regardless of whether you're querying for a single element

play10:23

or multiple elements.

play10:24

And you can use that Signal result in computed expressions

play10:27

and effects.

play10:27

It's overall more concise, more consistent, and better

play10:31

takes advantage of type inference.

play10:33

And on top of that, there is a bonus feature as well.

play10:36

With these new APIs, you can now mark a query as required.

play10:41

If a required query doesn't have a result,

play10:44

Angular will report an error.

play10:46

And because it will report this error,

play10:47

the API then can remove undefined from the type

play10:51

of the result since Angular guarantees that it's there.

play10:53

MINKO GECHEV: That's definitely going

play10:54

to allow developers to write safer code.

play10:56

JEREMY ELBOURN: Absolutely.

play10:57

JESSICA JANIUK: OK, now for the big one

play10:59

that everyone has been waiting for, Signal inputs.

play11:04

MINKO GECHEV: Yeah, we've been having a very popular issue

play11:07

about reactive inputs.

play11:09

JESSICA JANIUK: So if you've built anything with Angular

play11:11

before, you're familiar with input properties.

play11:14

Inputs are optional by default, but can also

play11:17

be marked as required.

play11:20

Here's the same with Signal-based inputs.

play11:23

And just like queries, you can use the values of these inputs

play11:26

in computed expressions and effects, which dramatically

play11:30

simplifies patterns where you're inspecting these values

play11:32

for changes in ngOnChanges.

play11:34

Input Signals are read only, so it always

play11:37

remains clear where a particular piece of state is coming from.

play11:41

MINKO GECHEV: So since we're talking about inputs,

play11:43

are we doing anything about outputs?

play11:45

JEREMY ELBOURN: Why, there certainly is.

play11:46

But I do want to make a bit of a clarification

play11:49

about outputs, which is that outputs are not actually

play11:53

signal-based.

play11:53

I've seen this as a common misconception

play11:56

among Angular developers.

play11:58

Outputs actually work the same way

play12:00

that they always have in Angular.

play12:02

MINKO GECHEV: So if outputs are not signal-based,

play12:04

why do we even have to introduce a new API?

play12:06

JEREMY ELBOURN: Well, there's a few different reasons

play12:09

that we'll talk about during this talk,

play12:10

but there is really just one big one.

play12:13

It looks kind of weird, really, if you're

play12:15

using the signal-based input and signal-based queries

play12:18

and the decorator-based output.

play12:20

We want the experience of authoring

play12:22

signal-forward components and directives

play12:24

to feel more holistic.

play12:26

And so let's take a look at that holistic API.

play12:30

MINKO GECHEV: Well, this definitely

play12:31

got rid of a lot of boiler plate as well.

play12:33

JEREMY ELBOURN: Yeah.

play12:33

Again, it's shorter, more readable.

play12:35

And you can't forget to create a new event

play12:38

emitter as part of this.

play12:40

So when you use this API, you can still

play12:43

call emit the same way that you always have,

play12:45

and event handling also still works the same way

play12:47

that it always has.

play12:49

JESSICA JANIUK: OK, so that finally

play12:51

brings us to model inputs.

play12:54

To talk about Model inputs, we need a brief aside

play12:57

on two-way binding.

play13:00

Sometimes you have a bit of state

play13:01

that you want to keep in sync between two components,

play13:04

and Angular has had a feature that lets you accomplish

play13:07

this called Two-Way Binding.

play13:09

In this example, whenever the isadmin value updates,

play13:12

the checked property of the checkbox

play13:14

also updates, and also the other way around.

play13:17

When someone interacts with the control and updates

play13:20

that checked state, those changes

play13:21

propagate back to isadmin.

play13:24

In the past, if you wanted to make a property two-way

play13:28

bindable, you had to introduce an input,

play13:30

but then also introduce an output that

play13:33

had the same name as the input, but with change on the end

play13:36

and also make sure that the output emits

play13:38

the same type as the input.

play13:40

MINKO GECHEV: Yeah, Jessica, I'll be honest,

play13:42

this looks pretty clunky to me.

play13:43

JESSICA JANIUK: It is pretty clunky.

play13:44

So fortunately, adopting Signals gives us an opportunity

play13:49

to make this a lot simpler.

play13:51

[APPLAUSE]

play13:53

So let's just jump back and forth a little bit.

play13:55

So you can compare the two.

play13:58

MINKO GECHEV: Way cleaner.

play14:00

I love it.

play14:00

I'm way happier with it.

play14:01

JESSICA JANIUK: Me too.

play14:03

So Model gives you a writeable signal

play14:06

so you can update values directly

play14:08

and then they propagate values back

play14:10

through those two-way bindings.

play14:13

So let's go back and look at how we're

play14:14

binding into this Model input again,

play14:16

but this time with a signal.

play14:18

Notice that the two-way binding passes the signal instance

play14:22

rather than reading the value from the signal.

play14:25

And in this way, the two-way binding

play14:27

defines an explicit contract where the profile component

play14:30

is granting access to the checkbox component

play14:33

to write new values, and making this explicit fits

play14:37

into our goal of making your code safe and predictable.

play14:41

JEREMY ELBOURN: Yeah, we really think

play14:43

that these new APIs are going to improve

play14:45

your experience authoring Angular components

play14:47

and directives.

play14:48

Again, they are all available right now

play14:51

in Developer Preview, the most recent of which, the output API,

play14:55

was released in Angular 17.3.

play14:58

MINKO GECHEV: So these APIs, they seem great.

play15:00

If I start using them right now, is my application

play15:03

going to be completely zoneless?

play15:04

And can I finally get rid of this zoneless

play15:07

import from my code or from angular.json from polyfills?

play15:12

JESSICA JANIUK: Well, we still have some improvements

play15:15

we want to make before we actually recommend

play15:17

that people go fully zoneless.

play15:19

Using the new signal APIs is a huge leap forward.

play15:22

There's still some work we need to do before the experience is

play15:25

as streamlined as we'd really like

play15:27

it to be, in particular, when it comes to how

play15:29

the framework schedules tasks and how you interact with change

play15:32

detection and tests.

play15:33

But we're making progress towards that point where

play15:37

we have a well-lit path forward in fully driving

play15:40

UI updates from signals.

play15:41

MINKO GECHEV: We may have some announcements in a couple

play15:44

of days [INAUDIBLE].

play15:45

Well, whenever we talk about signals on social media,

play15:48

we often get one question more frequently than others,

play15:51

and which is, how does RxJS fit in here?

play15:54

Well, together with everything we

play15:57

talked about so far, we have one more independent

play15:59

long-term effort, and it is to make RxJS optional, where

play16:03

optional means that we would like to enable you to build

play16:06

applications without strictly requiring and depending

play16:09

on RxJS in your bundle.

play16:11

This way, we can simplify Angular's learning journey

play16:14

so you don't have to start Angular and have yet to learn

play16:17

RxJS from the beginning.

play16:19

And also it is going to allow us to more holistically evaluate

play16:22

how we are using RxJS in Angular and be

play16:24

more intentional about it.

play16:26

And also it is going to enable you to ship applications

play16:28

with minimal dependencies.

play16:30

JEREMY ELBOURN: But importantly, for developers

play16:32

that choose to use RxJS, we want that integration to be

play16:36

better than it ever has been.

play16:39

And our approach to doing this is

play16:41

by introducing a set of interop APIs for Angular and RxJS.

play16:46

You can find these interop APIs under angular/core/rxjs-interop.

play16:52

You have probably already seen the first few APIs

play16:56

in this interop package, which lets

play16:58

you create RxJS observables from signals and the other way

play17:02

around.

play17:02

This, for example, provides you a way

play17:04

to create an observable from a signal-based input

play17:07

that we talked about earlier.

play17:09

But I think what we did with the new output

play17:11

API is a perfect example of how we're applying this philosophy.

play17:16

So let's take a look at this decorator-based output here.

play17:19

Now, not everyone may realize this,

play17:21

but this event emitter class actually extends RxJS's subject

play17:26

class, and that ends up being kind of confusing sometimes.

play17:30

Subjects have things like a completion state

play17:33

and an error state, which doesn't really apply to the way

play17:36

that Angular deals with events.

play17:38

Even more surprising, we discovered

play17:40

that some people were using a pattern like this,

play17:44

creating an output not with an event emitter,

play17:46

but with some arbitrary observable.

play17:49

MINKO GECHEV: I'm really surprised outputs

play17:50

were designed to do that.

play17:52

JEREMY ELBOURN: They actually were not designed to do this

play17:54

and this pattern has only ever worked by accident.

play18:02

So when we were creating this new output API

play18:05

we made the decision to make this API

play18:08

not strictly depend on RxJS.

play18:11

So when you call this output function,

play18:12

you are getting an object called output EmitterRef rather than

play18:18

an event emitter.

play18:20

And if you want to create an observable from this output,

play18:24

there's an API for that, OutputToObservable.

play18:28

And for those scenarios when you want to emit outputs

play18:30

based on an existing observable, you

play18:32

can use the new function OutputFromObservable.

play18:37

The work we did here on outputs was originally

play18:40

motivated by our goals with Signals and building Signals

play18:43

into components and directives, but it also

play18:46

gave us an opportunity to remove this strict dependency on RxJS

play18:50

in this API, while at the same time

play18:54

introducing these new functions that

play18:56

allow you to use RxJS more fluently and better supported

play19:00

than ever before, all of which helps you explicitly capture

play19:04

your intent with your code.

play19:06

JESSICA JANIUK: You know, Jeremy, that said, what are we

play19:08

doing to make sure that developers

play19:10

are using these APIs correctly?

play19:13

MINKO GECHEV: Well, let me jump in here, Minko here.

play19:15

So with all these new APIs and new patterns,

play19:18

we have been leveraging the Angular compiler

play19:20

so that it can help you catch common issues.

play19:23

For example, the compiler's extended diagnostics

play19:25

can statically analyze your templates

play19:27

and figure out whether you're using Signals without actually

play19:30

reading their values.

play19:31

This is specifically useful in conditional statements

play19:34

because signals are just functions,

play19:35

so they're truthy by default and you can easily

play19:38

get into this trap.

play19:41

Talking about debugging tooling, in version 17,

play19:43

we also shipped inspection of your applications injector tree,

play19:49

where you can see what is the relationship

play19:50

between the individual injectors and also what providers

play19:53

are declared inside of them.

play19:55

And if you go to the Component Explorer

play19:58

and select a particular component,

play20:00

you can preview its dependencies and also in which

play20:03

injector they were declared.

play20:06

JESSICA JANIUK: So while talking about developer tooling,

play20:08

we improved type narrowing in templates with the new control

play20:12

flow syntax.

play20:13

And in version 17, we introduced the most significant change

play20:17

to Angular's templating since the initial release of Angular.

play20:21

And we're very intentional about major changes to Angular,

play20:25

so we wanted to walk you through the process of how

play20:28

the new control flow came to be.

play20:31

We started, we ran user studies with developers

play20:34

to evaluate the ergonomics of our new signal-based APIs.

play20:38

So we had folks with various levels of experience

play20:41

in web development, and some of those people use Angular,

play20:44

but others were used to React, Vue and Svelte,

play20:48

et cetera, other frameworks.

play20:49

While watching them build an app with Angular,

play20:52

we noticed that all of them struggled

play20:55

with the template syntax and especially with looping over

play20:59

a collection of items.

play21:00

Everyone had to look up the syntax for ng4

play21:04

and many of the non-Angular developers

play21:06

couldn't even complete the task because the control flow was

play21:10

just so difficult for them.

play21:12

So we explored the space and we proposed the new control flow

play21:16

syntax in an RFC, and we received an overwhelming amount

play21:21

of feedback, a lot of great suggestions and comments.

play21:24

One of the comments proposed an alternative syntax

play21:28

that we actually originally didn't consider.

play21:32

That comment received a lot of positive feedback,

play21:35

so we actually decided to formally evaluate it

play21:39

with user research studies.

play21:41

And in addition to those studies,

play21:44

we asked about the syntax in our annual developer survey.

play21:47

And with over 12,000 responses, we saw a clear,

play21:51

overwhelming preference for the syntax proposed in that

play21:55

community comment.

play21:57

We're really happy that the new control

play21:59

flow is significantly more intuitive and closer

play22:03

to JavaScript.

play22:04

It makes it trivial to use patterns

play22:06

such as else if and enables better type narrowing.

play22:10

And best of all, you can actually automatically

play22:13

refactor your code to the new syntax using the Angular CLI.

play22:18

[APPLAUSE]

play22:23

MINKO GECHEV: And so also while we

play22:24

were introducing this new control flow syntax,

play22:26

we took the opportunity to improve our list diffing

play22:29

algorithm.

play22:31

This allowed us to improve the performance

play22:35

for some specific benchmarks with up to 90%

play22:39

and also position us pretty well in the JS framework benchmarks.

play22:44

We also saw some surprising results.

play22:45

Some of our customers, they started

play22:47

implementing the new control flow in their applications.

play22:49

And bill.com, they reported one second improvement

play22:53

in their largest contentful paint

play22:55

after switching to the new control flow.

play22:57

So make sure you give it a try.

play22:59

Using the Angular CLI, you can just run ng generate

play23:02

@angular/core:control-flow and the CLI will just refactor

play23:08

your project automatically for you.

play23:10

With this more readable syntax, you're

play23:13

also going to get some performance boost.

play23:14

JEREMY ELBOURN: Yeah, and the performance gains

play23:16

from control flow here are really

play23:18

the least of what we've been up to on the performance

play23:21

front over the last year, where we've really

play23:23

made a lot of progress.

play23:25

Recently, with the help of the Chrome Aurora team,

play23:28

we've shipped some improvements to Angular's optimized image

play23:31

directive.

play23:31

Now, in case you're not familiar with this,

play23:33

you can import ng optimized image

play23:36

and apply it to regular image elements in your code

play23:39

by using the ng source attribute rather than the normal source

play23:42

attribute.

play23:43

When you do this, you're enabling

play23:45

a suite of performance optimizations

play23:47

under the hood that can help improve your Core Web Vitals.

play23:50

Recently, we've added support for image placeholders,

play23:54

automatically generated preconnect links,

play23:56

and preload hints for SSR.

play24:00

We've seen some excellent evidence

play24:01

that this feature meaningfully improves Core Web Vitals.

play24:04

In some e-commerce platforms, we've

play24:07

recorded improvements of up to 75% in largest contentful paint

play24:12

when using this directive, so we highly

play24:14

recommend trying this feature out.

play24:17

JESSICA JANIUK: Last year, we also

play24:18

opened an RFC about declarative, lazy loading, and prefetching

play24:22

of code and we shipped that in Angular version 17,

play24:25

and it's now available.

play24:27

It allows you to extract parts of your templates

play24:30

and load them on demand.

play24:32

Among these amazing features we've shipped,

play24:34

this one is probably my favorite.

play24:37

Bill.com also uses deferrable views in production

play24:40

and they've managed to reduce the bundle size for one

play24:42

of their apps by 50%.

play24:45

MINKO GECHEV: Now, talking about performance,

play24:47

one of the most important technique when it comes down

play24:49

to optimizing for largest contentful paint is

play24:52

using hybrid rendering.

play24:53

And here, by hybrid rendering, we

play24:54

mean using a mixture of client-side rendering,

play24:57

pre-rendering, or server-side rendering.

play25:01

In Angular version 17, we notice a significant jump

play25:05

in the adoption of hybrid rendering.

play25:08

So the number of applications in HTTP archive that

play25:11

are using server-side rendering or pre-rendering

play25:14

increased by 37%, and developers have

play25:19

been benefiting from using this pre-rendering

play25:22

in server-side rendering.

play25:23

For example, Virgin Media O2, they

play25:25

reported 72% reduction in their largest contentful paint

play25:30

after switching to Angular's hybrid rendering.

play25:33

And there has been correlation between these improvements

play25:36

and the increased adoption.

play25:38

JEREMY ELBOURN: We think that part

play25:40

of the reason that so many developers have started adopting

play25:42

this hybrid rendering are the improvements

play25:44

we've made to Angular CLI's build system with esbuild.

play25:48

So in version 16 of Angular, we released

play25:51

a developer preview of this new esbuild-based

play25:54

build system tooling that entirely replaces webpack.

play25:58

To see the benefit of how we've integrated this

play26:01

into Angular CLI, let's look at the build pipeline.

play26:04

So we start off by running ng build.

play26:06

This triggers the TypeScript compiler and Angular's

play26:09

template compiler ngc.

play26:11

From there, we run through Angular's build optimizer path,

play26:15

and then only at this point do we

play26:17

take advantage of esbuild to produce

play26:19

separate client and server bundles,

play26:21

so we're not duplicating the earlier steps in the pipeline,

play26:24

thus speeding up the build.

play26:27

After switching to esbuild, Vanguard saw a three times

play26:31

speed improvement for the production

play26:32

build in one of their products.

play26:34

Starting in Angular version 17, we have made esbuild the default

play26:38

and you can also migrate existing applications

play26:41

with an Angular CLI schematic.

play26:43

MINKO GECHEV: And talking about good performance,

play26:46

we have also seen that ng serve has been

play26:48

benefiting a lot from Vite.

play26:51

We added the Vite plugin that introduces custom response

play26:55

resolution in the dev server.

play26:57

So based on the page that you're viewing,

play26:59

we're going to take different code paths.

play27:01

If you would like to request a pre-rendered page,

play27:03

we're just directly going to read it from the disk

play27:05

and return it.

play27:06

If you are doing server side rendering in the specific route,

play27:09

you're just going to run Angular server-side rendering logic.

play27:12

And in certain cases, you may request a JavaScript bundle,

play27:15

so we're going to have this lazy pre-bundling.

play27:17

We're going to lazily pre-bundle only

play27:19

the part, only the JavaScript that

play27:20

is needed on a particular page.

play27:22

And we strongly believe that the fast [INAUDIBLE]

play27:25

cycles are critical for developer's productivity,

play27:27

so we are really focused on optimizing for them.

play27:30

And there is one more interesting thing

play27:33

about the chart that we showed earlier about hybrid rendering

play27:36

adoption.

play27:37

So last year, we announced the developer preview of hydration.

play27:42

If we zoom in version 17, we're going

play27:44

to see that 76% of version 17 applications

play27:49

are already using hydration.

play27:51

Looking at HTTP archive, we also see that applications

play27:54

have been benefiting from it.

play27:56

So hydration has been reducing the largest contentful paint

play28:00

with about 200 milliseconds in the 60th to the 80th percentile.

play28:05

JEREMY ELBOURN: Yeah.

play28:05

And so talking about hydration here, let's

play28:08

actually talk a little bit about the way

play28:09

that full-page hydration, full-application hydration works

play28:14

in Angular today.

play28:15

So it starts off when your browser

play28:16

sends a request to the server and gets back a rendered HTML

play28:20

document.

play28:20

The browser is then going to parse that HTML

play28:23

and create a DOM structure.

play28:24

And while it's doing this, it's going

play28:26

to be downloading all of the pages JavaScript

play28:29

so that it can bootstrap the framework

play28:31

and then reuse all of that existing DOM structure

play28:35

that's hydrating the page and making it interactive.

play28:39

Recently, though, we have been researching

play28:42

how we might make this hydration process a little bit faster,

play28:45

a little bit better.

play28:46

And earlier, we talked about that collaboration

play28:49

with the Wiz team.

play28:51

And as it turns out, Wiz has kind

play28:53

of their own approach to doing hydration here

play28:56

that can improve things quite a bit.

play28:59

It starts off the same way.

play29:01

The browser sends a request to the server

play29:03

and gets back that rendered HTML document, still parsing it,

play29:06

creating the DOM structure.

play29:07

But what's different is that in this improved version,

play29:11

we don't eagerly load all of the JavaScript right away.

play29:15

Instead, we only load a thin event handling layer right

play29:20

at the top of the page.

play29:21

And when the user starts interacting with the app,

play29:23

this event handling layer can identify the JavaScript

play29:28

necessary in order to handle an event for a specific part

play29:32

of the page so that when that event comes in,

play29:35

it can then download only that subset of the JavaScript

play29:38

and hydrate the portion of the page needed to handle the event.

play29:41

This technique is called partial hydration.

play29:45

Partial hydration can help web applications

play29:48

reduce their initial bundle sizes,

play29:50

reducing their total blocking time and your Core Web Vitals.

play29:54

JESSICA JANIUK: So we've been actively prototyping

play29:56

partial hydration in Angular recently

play29:58

and we're very excited about it.

play30:01

Once we release deferrable views,

play30:02

we knew we actually had the perfect building

play30:04

block and foundation for what could actually power Angular's

play30:07

partial hydration.

play30:08

And with partial hydration, deferrable views

play30:11

will behave slightly differently than with the full application

play30:14

hydration.

play30:15

Rather than rendering your placeholder on the server,

play30:18

we'll actually render your deferrable view's main template

play30:22

instead.

play30:23

So now your deferred content actually is your placeholder.

play30:29

And then triggers will act to trigger

play30:31

fetching dependencies and hydrate

play30:33

rather than just rendering it.

play30:35

How cool is that?

play30:38

[APPLAUSE]

play30:43

So let's take a quick look at an example

play30:45

of how partial hydration will behave in a real application.

play30:49

And in this example, you'll see a basic web layout

play30:51

with a header, shopping cart, navigation, footer,

play30:54

and a product, and you'll also see several colors.

play30:57

So gray in this context means that it is dehydrated.

play31:00

Blue will mean that a section is hydrated,

play31:03

and orange means that section is actively, currently

play31:06

fetching dependencies.

play31:07

And we've also introduced some artificial delays

play31:10

so you can actually see what's happening when it happens.

play31:14

So when the page first loads, the outer layout

play31:17

of the application hydrates eagerly,

play31:19

but the product area stays dehydrated.

play31:22

And now when we click the Add To Cart button,

play31:25

it starts to fetch the dependencies

play31:26

of the product details component and its parent component.

play31:30

And once it finishes, it hydrates that content

play31:32

and now it's blue.

play31:33

But you'll notice the bottom two cards are still dehydrated

play31:36

and that's because we actually haven't

play31:38

interacted with them yet.

play31:40

Now if we click Add To Cart on one of those,

play31:42

we'll fetch and hydrate just that one card.

play31:45

So we now have seven loaded components

play31:48

and seven hydrated components.

play31:50

So if we click Add To Cart on the last item,

play31:53

it'll actually show eight components hydrated,

play31:56

but only seven loaded.

play31:57

And this is because this is a reused component,

play32:00

so we don't need to fetch those dependencies again.

play32:03

So now, if we refresh this whole page,

play32:05

and let's say we want multiple items

play32:07

and we click that Add To Cart button several times

play32:10

before it fetches or hydrates, in this case,

play32:13

we are actually queuing up those clicks

play32:15

and then we're replaying them again after hydration finishes.

play32:19

So we still end up with six items in the cart.

play32:23

JEREMY ELBOURN: So this capture and replay functionality

play32:26

is powered by a library called JSAction,

play32:28

which was originally created by the Wiz team for this purpose.

play32:32

JSAction works by inlining a small script

play32:35

at the top of your index.html that sets up some global event

play32:38

listeners.

play32:39

These listeners handle events fired

play32:41

by elements marked with a JSAction attribute, which

play32:43

can be added by Angular during server side rendering

play32:46

to any element that has an event handler.

play32:50

Events are then handled and saved in a queue

play32:53

and replayed once hydration is complete.

play32:56

In this way, any user interaction

play32:58

that occurs while the page is hydrating is not lost.

play33:03

Angular using JSAction in this way

play33:05

highlights how our collaboration and sharing with the Wiz team

play33:08

is improving the web for both developers and users alike.

play33:12

We talked earlier about how Wiz applications like YouTube

play33:15

are benefiting from all of the work Angular has done

play33:17

on Signals, and we can see now with this

play33:19

how Angular applications are benefiting

play33:21

from the knowledge and the expertise of Wiz with JSAction.

play33:24

We expect that partial hydration will

play33:27

be available for Angular developers

play33:29

to start trying out later this year.

play33:32

JESSICA JANIUK: And if you're using server-side rendering,

play33:34

you're going to need some place to deploy your application.

play33:38

The Angular and Firebase team have

play33:39

been collaborating to make Firebase App Hosting

play33:42

the new home for Angular apps with support

play33:45

for server-side rendering, client

play33:47

rendering, and pre-rendering.

play33:50

[APPLAUSE]

play33:56

MINKO GECHEV: Now, it's all this innovation happening in Angular

play33:59

lately, we have been also seeing a lot of advancements

play34:02

in the community.

play34:03

For example, popular state management libraries,

play34:06

they already provide signal support.

play34:08

JEREMY ELBOURN: And we'd also like

play34:10

to congratulate one of our GDEs, Brandon Roberts,

play34:12

on the 1.0 release of analog JS, a community-driven Angular meta

play34:17

framework.

play34:18

[APPLAUSE]

play34:23

One of the more interesting aspects of analog

play34:26

is the alternative component authoring format.

play34:29

This lets you build Angular components as single file

play34:32

components similar to Vue or Svelte,

play34:35

and we think it's really cool when the community explores

play34:38

ideas like this.

play34:40

We've had a lot of conversations on the Angular team

play34:42

about the friction points with Angular's component authoring

play34:45

experience and what we might do about them.

play34:48

And it's clear that Brandon has seen a lot of the same problems

play34:51

and is thinking about a lot of the same possible solutions.

play34:54

JESSICA JANIUK: Another piece of community

play34:56

work we're really excited about is TanStack, Angular support.

play35:00

Big thanks to the community for bringing

play35:02

TanStack query and store to the Angular ecosystem.

play35:04

MINKO GECHEV: And Jessica, I heard

play35:06

that recently someone introduced support for TanStack forms

play35:09

as well.

play35:10

JESSICA JANIUK: They did.

play35:12

So we've been evolving the framework quite a lot recently.

play35:15

But there's one thing that's been bugging me.

play35:19

This red shield logo seems really a bit 2010, maybe

play35:24

from the around the introduction of HTML5.

play35:27

MINKO GECHEV: Yeah and it used to have some border around it,

play35:31

but pretty much it has been the same in one form or another.

play35:35

JEREMY ELBOURN: Yeah, so we think

play35:36

it was time for a new look.

play35:37

And in version 17, we introduced a new logo

play35:40

to reflect the more future-looking direction

play35:43

of Angular.

play35:44

[APPLAUSE]

play35:49

But really, the logo is the smallest part

play35:52

of what we've been working on here.

play35:54

We've built a brand new documentation site

play35:57

at Angular.dev that modernizes Angular's documentation

play36:01

experience and adds some very useful new features.

play36:05

JESSICA JANIUK: In particular, we

play36:07

have a new interactive Getting Started tutorial

play36:10

that lets you learn hands-on step by step

play36:12

in the browser with StackBlitz web containers.

play36:15

This makes helps makes onboarding with Angular easier

play36:18

than it has ever been.

play36:21

One of the pages you might visit on Angular.dev

play36:24

is our roadmap, which details all our teams' big future plans.

play36:28

But we want to discuss a little bit today about what we're

play36:30

thinking about for the future.

play36:33

Our backlog is effectively infinite,

play36:35

but we've cherry picked a few exciting things

play36:38

near the top of the list that were either working on

play36:40

or are hoping to work on in the next year, like full zoneless,

play36:44

hot module replacement, streaming server-side rendering,

play36:47

and component authoring enhancements,

play36:49

just to name a few of those.

play36:51

MINKO GECHEV: The component authoring experience

play36:53

in particular is something that we

play36:54

have been thinking a lot about because it covers

play36:57

very critical API surface that developers

play36:59

are interacting with every day.

play37:01

Component selectors, they are powerful,

play37:03

but also introduce a lot of complexity in the framework

play37:06

and lead to a source of friction.

play37:08

Developers need to import a component twice,

play37:10

once in the JavaScript module and once

play37:12

in the component that is actually going to use it.

play37:16

But what if we could directly reference

play37:19

in a template using the symbol from the JavaScript module

play37:22

import instead?

play37:23

This could simplify a few things.

play37:25

First of all, we can remove this redundant import

play37:28

in the component metadata and we can reference the component

play37:31

directly with JavaScript symbol.

play37:34

This makes selectors unnecessary,

play37:36

so we can remove this and we can also

play37:38

flip the default value of the standalone flag

play37:41

from false to true so that we can remove this one as well.

play37:45

And while removing the redundant new lines,

play37:48

we get something like this.

play37:51

[APPLAUSE]

play37:56

Just to compare with the original version,

play37:59

and selectorless.

play38:01

Well, in this selectorless flavor,

play38:04

we have removed a lot of the boilerpate

play38:06

and, well, we are still in the early stages of development

play38:08

on that.

play38:09

We have an idea of how this may look for components,

play38:12

but for example, we need to design it

play38:13

for directives and pipes.

play38:16

When we have something more concrete,

play38:18

something more specific, we're going

play38:20

to share a request for comment so that we can collect feedback

play38:22

from the community on how we are living up to our mission.

play38:25

JEREMY ELBOURN: Yeah, and that brings us back around

play38:27

to what we talked about at the beginning of the talk, which

play38:30

is that our mission is to help developers

play38:32

like you deliver web apps with confidence.

play38:35

JESSICA JANIUK: We talked today about how

play38:37

we've improved performance with control flow, hydration,

play38:40

and deferrable views.

play38:41

MINKO GECHEV: We covered also the developer experience

play38:44

enhancements, such as Signals, developer tooling,

play38:47

and build optimization.

play38:49

JEREMY ELBOURN: And as always, we're

play38:50

evolving the framework to keep Angular as stable and reliable

play38:54

as possible.

play38:55

To learn more and try out all of the great Angular

play38:58

features that we talked about today, visit

play38:59

our website at Angular.dev.

play39:01

That is all we have for you.

play39:03

Thanks for watching.

play39:04

[APPLAUSE]

play39:05

[MUSIC PLAYING]

Rate This

5.0 / 5 (0 votes)

相关标签
Angular UpdatePerformance OptimizationDeveloper ToolsSignals APIControl FlowHybrid RenderingWeb DevelopmentFramework EnhancementsCommunity HighlightsFuture Roadmap
您是否需要英文摘要?