By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: Angular Signals Are A Game Changer: How They’re A Great Fit For Scalable Apps | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > Angular Signals Are A Game Changer: How They’re A Great Fit For Scalable Apps | HackerNoon
Computing

Angular Signals Are A Game Changer: How They’re A Great Fit For Scalable Apps | HackerNoon

News Room
Last updated: 2025/03/15 at 5:34 PM
News Room Published 15 March 2025
Share
SHARE

Signals in Angular are quite a new concept, so not everyone is using them nor is familiar with them. Creating a signal is quite easy:

const count = signal(0);

But what it really is? Well, it’s a construct that plays very well with reactive programming and Angular templates. Because so far Angular has had to do a lot of things to recognize what changes and when to update templates. Just to say zone.js is a really huge part of Angular, and it tries to tap into natural things like setTimeout functions to spy on stuff coders do to update things smoothly.

By the way, my name is Tom Smykowski, I’m an expert in building scalable, enterprise Angular applications, and in this series, I’ll be teaching you how to do it!

The OnPush method changed it because with this strategy, Angular reacts only to input changes and events. However, it’s not a perfect solution, and having to choose between ngOnChanges, get/setters for inputs, and Observables and Subjects isn’t really fun. All of these approaches come with more or less boilerplate that only obfuscates the feature-oriented components.

What’s even more important when working with asynchronicity in Angular is that it’s really easy to introduce memory leaks. All you have to do is not unsubscribe from a Subject (or BehaviourSubject etc.) or event-based observables (like fromEvent) for them to live not-quite rent-free forever in the device memory. It’s considerably the biggest drawback of these approaches.

Not a lot is said about it, but Angular Signals are also a solution to this problem. Specifically, as we can read in Angular documentation:

When you create an effect, it is automatically destroyed when its enclosing context is destroyed. This means that effects created within components are destroyed when the component is destroyed. The same goes for effects within directives, services, etc.

So, we don’t have to worry about this. Context knows about signals, and destroys them properly. So if you have a signal in your service or component, you don’t have to worry about a memory leak.

Moreover, and this is really impressive, is how signals handle Observables and RxJS. No doubt, signals, as of today, aren’t able to take over all the good RxJS gives, however, in some cases, we may not need RxJS when working with signals.

But what it means is that we could still be at risk of creating memory leaks when integrating signals and RxJS. The good news is that the unique construction of signals addresses this problem:

The toSignal function allows you to turn an Observable to signal:

import { Component } from '@angular/core';
import { AsyncPipe } from '@angular/common';
import { interval } from 'rxjs';
import { toSignal } from '@angular/core/rxjs-interop';
@Component({
  template: `{{ counter() }}`,
})
export class Ticker {
  counterObservable = interval(1000);
  // Get a `Signal` representing the `counterObservable`'s value.
  counter = toSignal(this.counterObservable, {initialValue: 0});
}

As we can see in this example provided by Angular documentation, counter becomes a signal tracking counterObservable. Because a standard observable doesn’t guarantee to emit a value, we set an initialValue, otherwise, it would be undefined.

This is, however, not the important part of the story, because the important one is that toSignal takes care of unsubscribing from the observable:

The subscription created by toSignal automatically unsubscribes from the given Observable when the component or service which calls toSignal is destroyed.

Basically meaning that it acts as a memory leak sanitizer, making sure that observables we use in components and services won’t create memory leaks because unsubscription is taken care automatically of.

It’s a considerable advantage of signals contributing to solving the major cause of lags of Angular apps. Since toSignal unsubscribes automatically when a service or component is destroyed, there’s no risk of human error.

What’s great? Of course, there are cases where memory leaks can still happen, and for those cases, we still can clear resources manually with manualCleanup which is called when the signal would normally do house chores.

From the perspective of building scalable Angular apps for this, and other reasons, I’ll write in the following articles, that signals are great for preserving resources, increasing the responsiveness of Angular apps, and saving resources, especially in apps that by themselves use a lot of these.

The streamlined handling of reactivity Angular 16 introduced with gradual feature build-up (like signal-based inputs in Angular 19) makes them a great fit for scalable apps due to lower maintenance costs, lower risk of memory leaks, and better overall performance. I recommend to gradually rewrite your app to signals if you want to scale it smoothly.

I’ve prepared a free checklist on how to make your Angular app scalable and ready for enterprise demand. If you’re interested, you can get this checklist for free here.

If you have any questions, ask them in the comment section!

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Android Quick Share could be about to double down on QR codes (APK teardown)
Next Article Hands on with the M4 MacBook Air: The sky blue color is SO subtle
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Generative AI in Sales: Use Cases & Examples |
Computing
Review: I compared Sony’s new XM6 headphones to the competition
News
Exclusive: Laser-powered fusion experiment more than doubles its power output | News
News
This Mother’s Day, the HIZERO F600 Becomes More Than a Gift: A Thank You for a Lifetime of Love and Labor
Gadget

You Might also Like

Computing

Generative AI in Sales: Use Cases & Examples |

28 Min Read
Computing

Generative AI in E-commerce: Use Cases & Examples |

25 Min Read
Computing

The HackerNoon Newsletter: Is AI Making People Delusional? (5/17/2025) | HackerNoon

2 Min Read
Computing

Jotform Pricing: Plans and Features to Choose the Best One

23 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?