<?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: Arbi Jridi</title>
    <description>The latest articles on DEV Community by Arbi Jridi (@arbi-jridi).</description>
    <link>https://dev.to/arbi-jridi</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%2F1335131%2F32cf410c-f72d-48af-a34f-892bea3607c9.png</url>
      <title>DEV Community: Arbi Jridi</title>
      <link>https://dev.to/arbi-jridi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arbi-jridi"/>
    <language>en</language>
    <item>
      <title>Say Goodbye to ngOnChanges() ..Hello Signal @Input in Angular 20</title>
      <dc:creator>Arbi Jridi</dc:creator>
      <pubDate>Mon, 09 Jun 2025 11:44:59 +0000</pubDate>
      <link>https://dev.to/arbi-jridi/say-goodbye-to-ngonchanges-hello-signal-input-in-angular-20-18lb</link>
      <guid>https://dev.to/arbi-jridi/say-goodbye-to-ngonchanges-hello-signal-input-in-angular-20-18lb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenozhdp02w57nzqtvijn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenozhdp02w57nzqtvijn.jpg" alt="Angular Signal @Input " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With Angular 20, the &lt;code&gt;@Input&lt;/code&gt; decorator got a signal-powered upgrade. You can now use Signals to receive input values reactively, making Angular components cleaner and more powerful.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Are Signals?
&lt;/h2&gt;

&lt;p&gt;Signals are reactive primitives introduced in Angular to help manage state and reactivity without external libraries like RxJS. They track dependencies and automatically update values when the source changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 What’s New in Angular 20?
&lt;/h2&gt;

&lt;p&gt;Angular 20 brings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Signal-based inputs via &lt;code&gt;@Input({ signal: true })&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Cleaner reactivity without manual &lt;code&gt;ngOnChanges&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Seamless integration with signal-based components&lt;/li&gt;
&lt;li&gt;Traditional vs Signal Input&lt;/li&gt;
&lt;li&gt;Traditional Input &lt;code&gt;@Input() name: string;&lt;/code&gt;
You would need ngOnChanges or manual checks to respond to changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Input with Signals in Angular 20
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Component, Input, signal } from '@angular/core';
@Component({
  selector: 'app-greeting',
  template: `&amp;lt;h1&amp;gt;Hello, {{ name() }}!&amp;lt;/h1&amp;gt;`
})
export class GreetingComponent {
  @Input({ signal: true }) name: Signal&amp;lt;string&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧠 Now, name is a signal, and you can call it as a function (name()), which automatically re-runs anything that depends on it when it changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  📘 Full Example: Parent to Child Communication Using Signal @Input
&lt;/h2&gt;

&lt;h2&gt;
  
  
  👨‍👩‍👧 Parent Component
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component({
  selector: 'app-parent',
  template: `
    &amp;lt;input [(ngModel)]="userName" placeholder="Enter name" /&amp;gt;
    &amp;lt;app-greeting [name]="userName"&amp;gt;&amp;lt;/app-greeting&amp;gt;
  `
})
export class ParentComponent {
  userName = 'َArbi';
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  👶 Child Component with Input Signal
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Component, Input, Signal } from '@angular/core';
@Component({
  selector: 'app-greeting',
  template: `
    &amp;lt;div class="greeting"&amp;gt;Hello, {{ name() }}!&amp;lt;/div&amp;gt;
  `
})
export class GreetingComponent {
  @Input({ signal: true }) name!: Signal&amp;lt;string&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎯 Why Use Signal Inputs?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  ✅ Benefits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No need for ngOnChanges&lt;/li&gt;
&lt;li&gt;Easier to compose with computed signals&lt;/li&gt;
&lt;li&gt;Automatic change detection&lt;/li&gt;
&lt;li&gt;Fine-grained reactivity&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧩 Combine with &lt;code&gt;computed()&lt;/code&gt; or &lt;code&gt;effect()&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { computed, effect } from '@angular/core';
@Component({
  selector: 'app-user-info',
  template: `
    &amp;lt;p *ngIf="isLongName()"&amp;gt;Long name detected&amp;lt;/p&amp;gt;
  `
})
export class UserInfoComponent {
  @Input({ signal: true }) name!: Signal&amp;lt;string&amp;gt;;
  isLongName = computed(() =&amp;gt; this.name().length &amp;gt; 5);
  constructor() {
    effect(() =&amp;gt; {
      console.log('User name changed:', this.name());
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔚 Conclusion
&lt;/h2&gt;

&lt;p&gt;Angular 20’s support for signal-based @Input is a leap toward declarative and reactive Angular. You get cleaner code, automatic updates, and better performance.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’re building a modern Angular app with signals, this feature is a must-use.&lt;br&gt;
ــــــــــــــــــــــ&lt;br&gt;
Thanks for reading and if you want more of this content about Angular and other cool stuff, &lt;br&gt;
see my repo here :&lt;a href="https://github.com/arbi-jridi" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
my personal Blog : &lt;a href="https://ngblog-2025.web.app" rel="noopener noreferrer"&gt;NgBlog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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