<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmad Alhafi</title>
    <description>The latest articles on DEV Community by Ahmad Alhafi (@ahmad_alhafi).</description>
    <link>https://dev.to/ahmad_alhafi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3461239%2F41392f97-f22b-4842-9716-50fbc9f9b95d.jpg</url>
      <title>DEV Community: Ahmad Alhafi</title>
      <link>https://dev.to/ahmad_alhafi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmad_alhafi"/>
    <language>en</language>
    <item>
      <title>Angular 19 — What’s up with Signals?</title>
      <dc:creator>Ahmad Alhafi</dc:creator>
      <pubDate>Tue, 26 Aug 2025 19:47:19 +0000</pubDate>
      <link>https://dev.to/ahmad_alhafi/angular-19-whats-up-with-signals-2h80</link>
      <guid>https://dev.to/ahmad_alhafi/angular-19-whats-up-with-signals-2h80</guid>
      <description>&lt;p&gt;The Signals that were Developer Preview in Angular v17 are now stable 🙂‍↕️&lt;/p&gt;

&lt;p&gt;These include the view/content queries (viewChild, viewChildren, contentChild, contentChildren) and also output.&lt;br&gt;
If you want a refresher on them, check out this post:&lt;br&gt;
&lt;a href="https://lnkd.in/dN_kPEhu" rel="noopener noreferrer"&gt;https://lnkd.in/dN_kPEhu&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What’s new in Angular 19?&lt;/p&gt;

&lt;p&gt;🎗 linkedSignal()&lt;/p&gt;

&lt;p&gt;Remember computed() signals? linkedSignal() works similarly, but it’s writable.&lt;/p&gt;

&lt;p&gt;It derives its value from another signal&lt;/p&gt;

&lt;p&gt;You can also manually update it anytime you want&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;const count = linkedSignal(() =&amp;gt; list().length);&lt;br&gt;
count.set(0); // You can manually set it now, even though it’s derived&lt;/p&gt;




&lt;p&gt;The next three signals are designed for reactive handling of async data, providing signals for loading, error, and value states.&lt;/p&gt;

&lt;p&gt;🎗 resource()&lt;/p&gt;

&lt;p&gt;A reactive API for managing async data (HTTP calls, loading, etc).&lt;/p&gt;

&lt;p&gt;Provides loading, error, and value states as Signals&lt;/p&gt;

&lt;p&gt;Supports reload and abort unnecessary operations (abortSignal)&lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;p&gt;things.value();&lt;br&gt;
things.error();&lt;br&gt;
things.loading();&lt;/p&gt;

&lt;p&gt;🎗 httpResource()&lt;/p&gt;

&lt;p&gt;A specialized version of resource() for HTTP requests using Angular HttpClient.&lt;br&gt;
Instead of building a resource from scratch:&lt;/p&gt;

&lt;p&gt;const things = httpResource({&lt;br&gt;
  request: () =&amp;gt; this.http.get('/api/things'),&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;Access states the same way:&lt;/p&gt;

&lt;p&gt;things.value();&lt;br&gt;
things.error();&lt;br&gt;
things.loading();&lt;/p&gt;

&lt;p&gt;🎗 rxResource()&lt;/p&gt;

&lt;p&gt;For when you want to keep using RxJS Observables within Signals.&lt;br&gt;
Instead of manually converting an Observable to a Signal (toSignal()), it wraps it automatically.&lt;/p&gt;

&lt;p&gt;things.value();&lt;br&gt;
things.error();&lt;br&gt;
things.loading();&lt;/p&gt;




&lt;p&gt;🐧 Quick comparison&lt;/p&gt;

&lt;p&gt;resource() → base API, you can build any resource (not just HTTP)&lt;/p&gt;

&lt;p&gt;httpResource() → ready-to-use specialization for HTTP requests using Angular HttpClient&lt;/p&gt;

&lt;p&gt;rxResource() → specialization for RxJS Observables to work seamlessly in the Signals ecosystem&lt;/p&gt;

&lt;p&gt;⚠️ All these new Signals in Angular 19 are Developer Preview.&lt;/p&gt;




&lt;p&gt;And that’s it!&lt;br&gt;
If you’re still unsure how it works, check out this post:&lt;br&gt;
&lt;a href="https://lnkd.in/dvFG2P3d" rel="noopener noreferrer"&gt;https://lnkd.in/dvFG2P3d&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>angular</category>
    </item>
    <item>
      <title>Signals in Angular 18 🔞, Signals cool upgrade</title>
      <dc:creator>Ahmad Alhafi</dc:creator>
      <pubDate>Tue, 26 Aug 2025 19:44:31 +0000</pubDate>
      <link>https://dev.to/ahmad_alhafi/signals-in-angular-18-signals-cool-upgrade-41ha</link>
      <guid>https://dev.to/ahmad_alhafi/signals-in-angular-18-signals-cool-upgrade-41ha</guid>
      <description>&lt;p&gt;She just turned 18, officially of age… now she’s grown 💪🏻&lt;/p&gt;

&lt;p&gt;With Angular 18, we can finally escape zone.js!&lt;br&gt;
Applications can now run without zone.js using zoneless change detection, and updates are fully controlled via Signals.&lt;/p&gt;




&lt;p&gt;🦧 How to make your Angular 18 app zoneless&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Remove zone.js from polyfills
Open angular.json and remove the "zone.js" line:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"polyfills": [&lt;br&gt;
  // "zone.js" &amp;lt;- remove this line&lt;br&gt;
]&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable Zoneless Change Detection
Add provideZonelessChangeDetection to the providers in your main.ts:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;import { provideZonelessChangeDetection } from '@angular/core';&lt;/p&gt;

&lt;p&gt;bootstrapApplication(AppComponent, {&lt;br&gt;
  providers: [provideZonelessChangeDetection()],&lt;br&gt;
});&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use Signals or ChangeDetectorRef for updates
Without zone.js, any UI updates must be triggered either via Signals or manually using ChangeDetectorRef.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No new Signals were added here, but the key takeaway is: we’re finally free from zone.js 😋&lt;/p&gt;




&lt;p&gt;If you’re still unsure how it works, check out this post:&lt;br&gt;
&lt;a href="https://lnkd.in/dvFG2P3d" rel="noopener noreferrer"&gt;https://lnkd.in/dvFG2P3d&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>angular</category>
    </item>
    <item>
      <title>Signals in Angular 17! Wow</title>
      <dc:creator>Ahmad Alhafi</dc:creator>
      <pubDate>Tue, 26 Aug 2025 19:40:50 +0000</pubDate>
      <link>https://dev.to/ahmad_alhafi/signals-in-angular-17-wow-n1p</link>
      <guid>https://dev.to/ahmad_alhafi/signals-in-angular-17-wow-n1p</guid>
      <description>&lt;p&gt;What changed? ☕️&lt;/p&gt;

&lt;p&gt;Well, as of this version, signal, effect, and computed are now stable and have officially graduated from Developer Preview ✨&lt;/p&gt;

&lt;p&gt;Plus, several new types of Signals hit the stage—some stable, some still in Developer Preview.&lt;/p&gt;




&lt;p&gt;🟢 Stable Signals&lt;/p&gt;

&lt;p&gt;🎗 input()&lt;/p&gt;

&lt;p&gt;Works like @Input—used to pass data from parent to child components.&lt;br&gt;
The difference? It’s Reactive by design, so you don’t need lifecycle hooks like ngOnChanges to track changes.&lt;/p&gt;

&lt;p&gt;🎗 model()&lt;/p&gt;

&lt;p&gt;Supports two-way binding natively with Signals.&lt;br&gt;
Why use it? You can bind a value inside a child component directly to the parent, keeping changes in sync both ways.&lt;br&gt;
Old equivalent: @Input() + @Output() + EventEmitter (for [(ngModel)] or [(value)]).&lt;br&gt;
Honestly… a huge improvement ☕️&lt;/p&gt;




&lt;p&gt;🟠 Developer Preview Signals&lt;/p&gt;

&lt;p&gt;🎗 output()&lt;/p&gt;

&lt;p&gt;Works like @Output—used to emit data from child components or notify the parent.&lt;br&gt;
Reactive by design, so no lifecycle hooks like ngOnChanges are needed.&lt;/p&gt;

&lt;p&gt;🎗 viewChild() &amp;amp; viewChildren()&lt;/p&gt;

&lt;p&gt;Equivalent to the old @ViewChild and @ViewChildren.&lt;br&gt;
They access the first matching element / all matching elements inside the same template.&lt;br&gt;
The difference? They’re native reactive, so any changes or reinitializations are reflected immediately.&lt;br&gt;
Simpler code, no need for AfterViewInit to track changes.&lt;/p&gt;

&lt;p&gt;🎗 contentChild() &amp;amp; contentChildren()&lt;/p&gt;

&lt;p&gt;Access the first/all projected elements from the parent ().&lt;br&gt;
Old equivalent: @ContentChild and @ContentChildren.&lt;br&gt;
Difference? The new ones are reactive, so any change in projected content appears immediately—no need for AfterContentInit or AfterContentChecked.&lt;/p&gt;

&lt;p&gt;The last four Signals are called Signal Queries.&lt;br&gt;
If you want to read more, check the official docs:&lt;br&gt;
&lt;a href="https://lnkd.in/dK3p8wAk" rel="noopener noreferrer"&gt;https://lnkd.in/dK3p8wAk&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>angular</category>
    </item>
    <item>
      <title>Signals in Angular 16, Signals beginning</title>
      <dc:creator>Ahmad Alhafi</dc:creator>
      <pubDate>Tue, 26 Aug 2025 19:37:31 +0000</pubDate>
      <link>https://dev.to/ahmad_alhafi/signals-in-angular-16-signals-beginning-38mn</link>
      <guid>https://dev.to/ahmad_alhafi/signals-in-angular-16-signals-beginning-38mn</guid>
      <description>&lt;p&gt;Sure, it’s a bit rudimentary, but honestly, I like it 🪵&lt;/p&gt;

&lt;p&gt;Alright, let’s dive into the core types of Signals in their first version, v16:&lt;/p&gt;

&lt;p&gt;🎗 signal()&lt;/p&gt;

&lt;p&gt;Stores a reactive, writable value.&lt;/p&gt;

&lt;p&gt;A bit funny when we mix Arabic terms with programming, but here’s the explanation:&lt;br&gt;
It’s a value you can store and update, and it’s reactive—so whenever it changes, anywhere you use it (in HTML or code) updates automatically.&lt;/p&gt;

&lt;p&gt;You can update the value in two ways:&lt;/p&gt;

&lt;p&gt;signal.update() → modifies the value based on the previous value&lt;/p&gt;

&lt;p&gt;signal.set() → sets a new value directly, without relying on the old value&lt;/p&gt;




&lt;p&gt;🎗 computed()&lt;/p&gt;

&lt;p&gt;A value derived from an existing signal, reactive but read-only.&lt;/p&gt;

&lt;p&gt;It depends on other signals in your code and cannot be modified directly using set() or update().&lt;br&gt;
You can use it just like a signal, both in templates and in code.&lt;/p&gt;




&lt;p&gt;🎗 effect()&lt;/p&gt;

&lt;p&gt;Executes a side effect whenever a dependent signal changes.&lt;/p&gt;

&lt;p&gt;For example, in the image, when the count signal changes, it automatically logs a value to the console.&lt;/p&gt;




&lt;p&gt;Important note: In v16, Signals are still in Developer Preview / PoC stage.&lt;br&gt;
That means it’s proof that the solution works and can solve specific problems, but we’re still using zone.js under the hood.&lt;/p&gt;

&lt;p&gt;And that’s it!&lt;/p&gt;

&lt;p&gt;If you’re still unclear about how it works, check out this post:&lt;br&gt;
&lt;a href="https://lnkd.in/dvFG2P3d" rel="noopener noreferrer"&gt;https://lnkd.in/dvFG2P3d&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>angular</category>
    </item>
    <item>
      <title>Why and What? Signals in Angular!</title>
      <dc:creator>Ahmad Alhafi</dc:creator>
      <pubDate>Tue, 26 Aug 2025 19:32:24 +0000</pubDate>
      <link>https://dev.to/ahmad_alhafi/why-and-what-signals-in-angular-kcc</link>
      <guid>https://dev.to/ahmad_alhafi/why-and-what-signals-in-angular-kcc</guid>
      <description>&lt;p&gt;Because Angular, my friends, is Angular, and because it’s a Framework, not just a library, I felt it wasn’t great to rely on external stuff for state management… so they created Signals 🦧&lt;/p&gt;

&lt;p&gt;Let’s take a step back before diving into Signals.&lt;/p&gt;

&lt;p&gt;Angular used to rely on a mechanism called Dirty Checking, using the well-known library zone.js to track changes.&lt;/p&gt;

&lt;p&gt;So, what was the problem?&lt;br&gt;
Even if you changed a tiny value, Angular would check all components to see if anything changed—even when it wasn’t necessary 🦧&lt;/p&gt;

&lt;p&gt;This meant a lot of unnecessary updates and poorer performance.&lt;/p&gt;

&lt;p&gt;That’s where Signals come in.&lt;/p&gt;

&lt;p&gt;Signals gradually eliminate zone.js and move Angular to Fine-Grained Reactivity, which is exactly how Signals work.&lt;br&gt;
The idea is to make everything reactive in a smarter way:&lt;br&gt;
🔫 If a value changes, only the part of the UI related to that value updates—no more scanning everything like before.&lt;/p&gt;

&lt;p&gt;It’s important to know that Signals are basically an implementation of the Observer Design Pattern inside Angular.&lt;br&gt;
Simply put:&lt;/p&gt;

&lt;p&gt;You have Observables (the values)&lt;/p&gt;

&lt;p&gt;And Observers (the UI pieces or code that care about those values)&lt;/p&gt;

&lt;p&gt;As soon as the value changes, all relevant Observers are notified directly and update themselves immediately.&lt;br&gt;
So instead of Angular checking the whole project asking “who changed what?”, the info goes straight to the Observers—who are chilling with a coffee ☕️.&lt;/p&gt;

&lt;p&gt;That’s Signals in a nutshell!&lt;br&gt;
If any term feels unclear, drop a comment and we’ll chat 😋&lt;/p&gt;

&lt;p&gt;If you want a deeper dive on what it actually does, check out this post:&lt;br&gt;
&lt;a href="https://lnkd.in/dvFG2P3d" rel="noopener noreferrer"&gt;https://lnkd.in/dvFG2P3d&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>frontend</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
