Last week, I covered the new @let
syntax to create local variables in our HTML templates.
Let’s review some other notable updates from Angular 18.1.
toSignal() custom equality function
Remember the toSignal
function to convert an Observable into a Signal? This function now supports an equal
parameter to pass a custom equality function. You can read this tutorial on Signal equality functions for more information and examples.
RouterLink with UrlTree
You’ve probably used UrlTree
objects in Angular route guards to implement redirects when a user isn’t logged in, for instance. It is now possible to use UrlTree
with RouterLink
, too, so you can do something like this:
After defining userPath
as a UrlTree
as follows:
Diagnostic for uninvoked functions
An added diagnostic throws an Angular error if you make a mistake in your template syntax. If you do (click)="save"
instead of (click)="save()"
.
There are some other changes under the hood and some updates to unstable APIs, but I’ll cover those when the changes are finalized and become stable.