Visualizing internal dependencies with Madge

When working on large Angular projects, managing dependencies between files and modules can become a significant challenge. Madge is a developer tool that visualizes and analyzes module dependencies in JavaScript applications, making it an excellent companion for Angular developers.

Here is how to give it a try:

  1. Install madge: npm install -g madge
  2. In the root folder of your project, run: npx madge src/main.ts --ts-config tsconfig.json --image ./deps.png

This command will go through your entire application and create a dependency graph as an image in deps.png:

This can be used to identify circular dependencies, visualize relationships between your different components and services, and identify spaghetti code scenarios.

Note that Madge has other specific commands, such as one to detect circular dependencies:
npx madge --circular src/main.ts --ts-config tsconfig.json

Or that one to detect dead code (code that is never referred to anywhere in your app):

npx madge --orphans src/main.ts --ts-config tsconfig.json

You can find more information on Madge’s NPM page here.

Injection context, Angular talks, and more!

This week, we’re back to the 3-2-1 format of the newsletter. I’m posting a few essential articles to revisit, updates to know about, and one question to ponder:

Three (maybe four) articles to revisit:

  • Have you ever used ElementRef in Angular? It’s a way to access DOM elements natively, which can come in handy when integrating with some 3rd party libraries.
  • With the introduction of takeUntilDestroyed and the inject function, it has become more important than ever to understand what is an injection context.

Two quick updates:

  • A talk I’m looking forward to: The Angular team is presenting a “Deep Dive into the Angular Signal Forms” at Angular Connect on September 13th. Could it be a sign of imminent release in developer preview? Wait and see…

One question to ponder:

  • With Angular Signals now in the mix, many are rethinking their state management strategy. If you’re a long-time user of a state management library, has your perspective shifted? Knowing what you know now, would you still reach for a library on a new project?

Angular Newsletter Survey

It’s been quite some time since I last asked for feedback about the newsletter, and since we’re in the midst of summer and things tend to be a bit slower during that time of year, I thought now would be a good time to ask for your feedback.

Here is the feedback form for you, with just five quick questions and the option to provide more elaborate feedback if you wish. I’m always looking for external contributors, too, so feel free to let me know if you’d like to write about something interesting.

The regular newsletter will be back next week with a full article on the blog.

What’s new in Angular 20.1?

Angular 20.1 was just released by the Angular team, with a lot of good tools for improved developer experience:

Developer Tools

  • Signal Dependency Graphs: The Angular devtools extension includes an experimental feature to visualize the dependencies between signals in a graph. You can also inspect a signal and jump directly to its definition in the code. Signals also “blink” in the graph when their value changes.

Testing

  • Simplified Component Testing: New binding helpers (inputBinding(), outputBinding(), twoWayBinding()) allow you to set a component’s bindings directly during testing, without doing manual assignments or using wrapper components.

Performance

  • Optimized Template Compilation: The Angular compiler now uses more efficient, DOM-only instructions for elements that don’t have any directives applied, leading to better runtime performance.

Templates

  • Assignment Operators: You can now use assignment operators like +=, -=, and *= directly in your component templates.
  • NgOptimizedImage Decoding: The NgOptimizedImage directive now includes a decoding option, which can be set to async to avoid blocking the main JS thread.

HTTP Client

  • New HttpClient Options: A variety of new options have been added to HttpClient, including timeout, cache, priority, and credentials, giving you more control over HTTP requests and helping to improve Core Web Vitals.

AI and Angular CLI

  • AI-Assisted Development: Angular is integrating with AI development tools through the new ng mcp command, which starts a Model Control Protocol (MCP) server. This allows AI tools to better understand your Angular workspace for more accurate suggestions.
  • New Asset Loaders: The CLI now supports dataurl and base64 loaders, allowing you to inline small assets directly into your application’s code.

Angular Performance tools and suggestions

In the 3-2-1 format of the newsletter, I’m posting a few essential articles to revisit, updates to know about, and one question to ponder:

Three articles to revisit:

  • This series shows how simple template changes can impact performance: part 1part 2part 3.

Two quick updates:

  • Angular v20.1 is coming soon (the first RC is out) with new options and improvements for httpResource regarding authentication and caching.
  • The Angular team just posted more details about the new devtools track in Chrome, and it’s definitely a big improvement in terms of data integration, all in one place. The article features a few screenshots explaining the different colors used in the track, which seems well thought out and useful.

One question to ponder:

Do you use TypeScript path mapping to simplify your TS imports? If not, here’s what it does and how to enable it.

State Management, React, and Gemini

In the 3-2-1 format of the newsletter, I’m posting a few essential articles to revisit, updates to know about, and one question to ponder:

Three articles to revisit:

  • Even though Signals are changing the state management landscape in Angular, it’s still a good idea to know the basics of state management libraries to make an informed decision. Here are some past tutorials to learn about actions, reducerseffectsstate and store, or if you’d rather watch videos about it, I have this video course on LinkedIn Learning.

Two quick updates:

One question to ponder:

  • If you ever hear someone claiming that Angular is done, that everybody uses React these days, or any similar nonsense, here is a resource you can mention to such people:  https://www.madewithangular.com. That list is, of course, non-exhaustive, but the number of airlines and banks listed here should be plenty enough to silence doubters. And yes, Gemini, Google’s AI that beats ChatGPT in several areas, is made with Angular, too!

HTTP interceptors in Angular, using functions

In the past few years, Angular has started replacing some class-based features, such as guards and interceptors, with new function-based syntaxes.

What’s interesting about interceptors is that the old, dependency injection-based approach is not deprecated and remains valid, though it’s a bit more verbose and less convenient.

That said, I just updated this 2019 tutorial of mine to cover function-based interceptors instead:

The updated tutorial includes examples for intercepting both HTTP requests and responses.

Angular Profiling in Chrome’s Performance Dev Tools

Angular 20 introduced a new custom track in Google Chrome for extended information about events, change detection cycles, bindings, and more.

Here is what the track looks like – it can get toggled open or closed:

In the example above, we can see that a browser interaction triggered change detection in the AppComponent, which is pretty typical in a Zone.js-based Angular application.

The main benefit of the new track is that it ties together Angular-related information with regular browser information, such as memory usage and CPU usage, unlike the regular Angular DevTools extension, which gives Angular-specific information only.

To use the new track, ensure your project runs on Angular 20 in development mode. Then, open the browser developer tools, click on the “Performance” tab, and click the “Record” button (similar to the Angular DevTools profiler). Then, interact with the application and click “pause” when you want to stop the profiler and analyze the performance recording.

You can zoom in or out to focus on specific events of the recording and get detailed information about what happened at these different moments. This tool is perfect to detect useless change detection cycles that could be optimized by using the OnPush change detection strategy, for instance.

If you’re looking for more performance-related advice, my course “Angular Performance Optimization techniques” on LinkedIn Learning might be precisely what you’re looking for.

Angular 20 is available, and FrontEnd Nation is next week

In the 3-2-1 format of the newsletter, I’m posting a few essential articles to revisit, updates to know about, and one question to ponder:

Three updates worth knowing about:

  • Angular 20 is officially available! You can watch this video from Google/IO about what’s new in Angular and tune in at 9 am US/Pacific tomorrow on the Angular team’s YouTube channel for a live launch event.
  • With Angular 20 comes a new style guide with different naming conventions and a new set of best practices. I’ll cover those in more detail in future newsletters, but the style guide is worth taking a look at now that it has been officially released.
  • Next week, FrontEnd Nation will have a track on Angular with a v20 talk by Minko Gechev. I’ll be speaking about resources, the most game-changing API in Angular since the launch of Signals. The event is free to attend; all you have to do is register and tune in.

Two short articles to revisit:

One question to ponder:

  • You’ve probably heard about “Zoneless” Angular, but do you know what that means? I you don’t, please reply to that email and I’ll cover that topic in a next edition of this newsletter.

Angular at Google I/O 2025

I’m writing this post from Google I/O, the annual conference where Google announces updates about all its products and services. This year, AI was everywhere and dominated most sessions, yet we received a good update from the Angular team about what to expect for Angular 20 and later this year:

First, a few confirmed items for Angular v20:

  • linkedSignal becomes stable, graduating from developer preview
  • Zoneless Angular will be available in developer preview
  • Vitest support for unit tests as an experiment
  • Angular custom track in Google Chrome performance dev tools tab for Angular-specific insights on performance
  • SSR: Event replay is enabled by default
  • A list of new AI resources for Angular: https://angular.dev/ai
  • Angular 20’s official launch event is on May 29th at 9 am US/Pacific.

Signal Forms are a work in progress, with a first prototype branch here, but nothing’s fully working yet, so take a look only if you’re curious about what the future of Angular forms could look like.

What else about Google I/O?

If you’re curious about what was announced at Google I/O, I’d recommend this 10-minute short recap video.

Generative AI is improving super quickly, and I was able to generate this 8-second video from a single picture taken with my phone – none of the movement you see in here actually happened, it was all AI-generated using Veo 3, the latest AI engine for video generation from Google. Some of the video examples are truly impressive.