{"id":1658,"date":"2023-10-20T05:00:00","date_gmt":"2023-10-20T12:00:00","guid":{"rendered":"https:\/\/www.angulartraining.com\/daily-newsletter\/?p=1658"},"modified":"2023-10-06T14:31:51","modified_gmt":"2023-10-06T21:31:51","slug":"angular-change-detection-illustrated","status":"publish","type":"post","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/angular-change-detection-illustrated\/","title":{"rendered":"Angular Change Detection Illustrated"},"content":{"rendered":"\n<p>I see a lot of confusion around Angular change detection. I compared the <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/change-detection-for-angular-components\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><code>OnPush<\/code> and <code>Default<\/code><\/a> strategies in a past post, but let&#8217;s illustrate them with visuals.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Default Change Detection<\/h3>\n\n\n\n<p>An event happening anywhere in the DOM tree will have Angular check the entire tree for changes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1064\" height=\"677\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/10\/Default-change-detection-1.gif\" alt=\"\" class=\"wp-image-1661\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">OnPush Change Detection<\/h3>\n\n\n\n<p>If a hierarchy of components is using <code>OnPush<\/code>, then only that branch on OnPush components will be checked for changes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1064\" height=\"677\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/10\/onPush-change-detection.gif\" alt=\"\" class=\"wp-image-1662\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Signal Change Detection<\/h3>\n\n\n\n<p>This is the future of Angular. When using <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/signals-why-and-when-do-we-need-them\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Signals<\/a>, only the views of components that use that Signal will get updated, making it the best and most accurate option:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1064\" height=\"677\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/10\/signal-change-detection.gif\" alt=\"\" class=\"wp-image-1664\"\/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see a lot of confusion around Angular change detection. I compared the OnPush and Default strategies in a past post, but let&#8217;s illustrate them with visuals. Default Change Detection An event happening anywhere in the DOM tree will have Angular check the entire tree for changes: OnPush Change Detection If a hierarchy of components [&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,21],"tags":[],"class_list":["post-1658","post","type-post","status-publish","format-standard","hentry","category-angular","category-architecture"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1658","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=1658"}],"version-history":[{"count":5,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1658\/revisions"}],"predecessor-version":[{"id":1667,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1658\/revisions\/1667"}],"wp:attachment":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/media?parent=1658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/categories?post=1658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/tags?post=1658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}