In Angular, Structural Directives are directives that can alter the DOM layout by dynamically adding or removing elements.Up until Angular 17, we are familiar with the common directives like *ngIf and *ngFor. However, these directives are replacedby built-in control flows, but structural directive conceptitself is here-to-stay. With that being said, this blog post aims to take your understandingof Structural Directives to the next level and they are more than just control flows.
12/5/2023In this short post, we'll look at how we can create better custom inject functions
9/6/2023(hot take) I want to use InjectionToken for almost all my services
3/30/2023When we need to interact with an external API (DOM, Canvas, etc...) that is imperative and the interaction needs to have: initialization, clean up, and final disposal. We need to react to Observable emissions. With ngrx/component-store, we have effect() to setup an effect that can react to Observable emissions. Combined with tap(), we then have a somewhat robust solution, but there's still something missing. Considering the following use-case: I have a stream of a HTML element { width, height }, eg: size$. Based on size$, I want to registerAnimationFrame to start some animations. On size$ changes, I want to clean up the previously registered animation with cancelAnimationFrame() based on some comparison logic between the prevous size versus the new size
11/1/2022