{"id":2120,"date":"2024-07-17T15:23:16","date_gmt":"2024-07-17T22:23:16","guid":{"rendered":"https:\/\/www.angulartraining.com\/daily-newsletter\/?p=2120"},"modified":"2024-07-17T15:23:17","modified_gmt":"2024-07-17T22:23:17","slug":"whats-new-in-angular-18-1","status":"publish","type":"post","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/whats-new-in-angular-18-1\/","title":{"rendered":"What&#8217;s new in Angular 18.1?"},"content":{"rendered":"\n<p>Last week, I covered the new <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/let-for-local-variables-in-angular-views\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><code>@let<\/code> syntax to create local variables<\/a> in our HTML templates. <\/p>\n\n\n\n<p>Let&#8217;s review some other notable updates from Angular 18.1.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">toSignal() custom equality function<\/h4>\n\n\n\n<p>Remember the <code><a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/rxjs-and-signals-interoperability\/\" target=\"_blank\" rel=\"noopener\" title=\"\">toSignal<\/a><\/code> function to convert an Observable into a Signal? This function now supports an <code>equal<\/code> parameter to pass a custom equality function. You can read this <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/signals-custom-equality-functions\/\" target=\"_blank\" rel=\"noopener\" title=\"\">tutorial on Signal equality functions<\/a> for more information and examples.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">RouterLink with UrlTree<\/h4>\n\n\n\n<p>You&#8217;ve probably used <code>UrlTree<\/code> objects in <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/route-guards-canactivate-canactivatechild-candeactivate\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Angular route guards<\/a> to implement redirects when a user isn&#8217;t logged in, for instance. It is now possible to use <code>UrlTree<\/code> with <code>RouterLink<\/code>, too, so you can do something like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"25\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-8.png\" alt=\"\" class=\"wp-image-2121\" srcset=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-8.png 502w, https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-8-300x15.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>After defining <code>userPath<\/code> as a <code>UrlTree<\/code> as follows:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"592\" height=\"21\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-9.png\" alt=\"\" class=\"wp-image-2122\" srcset=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-9.png 592w, https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2024\/07\/image-9-300x11.png 300w\" sizes=\"auto, (max-width: 592px) 100vw, 592px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Diagnostic for uninvoked functions<\/h4>\n\n\n\n<p>An added diagnostic throws an <a href=\"https:\/\/next.angular.dev\/extended-diagnostics\/NG8111\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Angular error<\/a> if you make a mistake in your template syntax. If you do <code>(click)=\"save\"<\/code> instead of <code>(click)=\"save()\"<\/code>.<\/p>\n\n\n\n<p>There are some other changes under the hood and some updates to unstable APIs, but I&#8217;ll cover those when the changes are finalized and become stable. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week, I covered the new @let syntax to create local variables in our HTML templates. Let&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2120","post","type-post","status-publish","format-standard","hentry","category-angular"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/2120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/comments?post=2120"}],"version-history":[{"count":2,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/2120\/revisions"}],"predecessor-version":[{"id":2124,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/2120\/revisions\/2124"}],"wp:attachment":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/media?parent=2120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/categories?post=2120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/tags?post=2120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}