Angular Signal vs BehaviorSubject

preview_player
Показать описание
Signal vs RxJS Behavior Subject. Fight! Just kidding. 😆

In reality, there are use cases for both. In this video, we take a look at how to replace a synchronous BehaviorSubject stream with a signal.

Starting in Angular v16, Angular developers can leverage the power of signals to create more reactive applications. Signals provide a new way for our code to inform our templates that data has changed, offering more granular control over how and when updates are propagated with change detection. If you aren't familiar with signals, consider watching my introductory signals video first. You can find the link below.

*Links*

*Content*
00:00 Signal vs BehaviorSubject ... Fight!
00:37 Existing BehaviorSubject code
01:44 Replacing the BehaviorSubject
03:17 Updating the Input property
04:33 Creating a computed signal
05:27 Creating a signal for an array
05:40 Binding to signals
06:38 Running to validate our changes
06:57 Why replace a BehaviorSubject with a signal?

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I'm a software developer and YouTube content creator. I speak at conferences such as VS Live and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 10,000+) over the past 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#angular #signals #bestpractices #angularsignals #signalsinangular #demo #signaltutorial #angular16 #rxjsandsignals #signalsandrxjs #signalvsbehaviorsubject
Рекомендации по теме
Комментарии
Автор

Great video—straight to the point with clear explanations.

zb
Автор

Deborah, you are truly a treasure for the Angular community. You have the rare skills of being able to take complex tech and convert it to Human.

ianvink
Автор

This Signals series is amazing. Your teaching style is really good. If possible a future video on testing the Signals would be great addition to the series.

rkrao
Автор

Good to hear from you again Deborah, thanks for the explanation!

respostasimples
Автор

can't wait for that video on signal-based inputs!

respostasimples
Автор

I did not watch the entire video but I did not find any section that explains in what scenario would you prefer BehaviorSubject? My thinking is that you will never prefer it over signals, and I'm actually considering writing a script that automatically converts all BehaviorSubjects to signals.

ShaharHar-Shuv
Автор

I love your videos!! You are the best at teaching. Thanks for this!! From Chile

cristobalcanas
Автор

Awesome, I am having a good understanding of signal, infact more signal series..Thank you

tmegha
Автор

very good feature ın Angular, looking forward to hear more simplified

celikart
Автор

Thank you for this video Deborah. Can you include in your next videos this scenario: fetching data from API when we click on some button for example and managing this data in a service with signals ?

mitkogeorgiev
Автор

Hi Deborah, always glad to see your videos. I would like to know if there's a way to handle isLoading state when a signal is getting information from Observables. Thanks for these short videos

andresmauriciofajardoolaya
Автор

Amazing video @deborah_kurata.
Look forward to watch managing state with Signals 👀

daguttt
Автор

What I personally would like to see maybe is how you would do most common operators with Signals when you have e.g. switchmap, map, combineLatest. Would you still use RxJS and forward the stream to the signal?

muhamedkarajic
Автор

What does this do to performance, calling the 'signal function' cartItem() over and over in your template vs reading a single fixed variable?

samanthaadrichem
Автор

Great videos, one question, if I start using signals with my app, should be safe to change all my components to OnPush right ?

alejandromenganaperez
Автор

Hi Deb. Thanks for the video, it's really amazing! Also it could be the good adding source code link to the description! Waiting for next videos..

masumulu
Автор

Hi Deborah, thank you for the video! I got the main reasons why to switch I think not needing 'subscribe' and async is really a good point. What I wonder is if there is hope they implement it so that we get those benefits of change detection when using RxJS as well?

muhamedkarajic
Автор

Great tutorial, but who tf uses vscode with light theme 😂

zenande