Angular Signals & the new resource & rxResource methods for Efficient Data Fetching (First look)

  Рет қаралды 861

Code with Ahsan

Code with Ahsan

Күн бұрын

Пікірлер: 10
@arpitgarg6459
@arpitgarg6459 13 күн бұрын
As an extensive rxjs user, I find the rxResource method much more easier and intutive to use in my daily routine. Thanks for the great explanation. Love your videos...
@alissonprimo
@alissonprimo 21 күн бұрын
Great explanation! Thanks! ❤
@tjlav5
@tjlav5 23 күн бұрын
Value is T|undefined because the value is undefined until the loader resolves (or when a new request kicks off)
@CodeWithAhsan
@CodeWithAhsan 23 күн бұрын
Makes sense. Thanks for sharing!
@alm-r4w
@alm-r4w 9 күн бұрын
unrelated the to the video but i would really like to hear your input on this: i work with angular for few years now and i mostly saw people design http request function in a way that it always returns the data directly in the component its used in. and i do so to bc i never thought of doing this differently. so only recently i discovered the idea of saving http requests in variable inside the service and then work with behaviour subjects to update components with the data from the that variable and work with behaviour subjects. And in every case where u use data data multiple times it seems way more logical and practical for statemanagement so i started using it this way almost everywhere except if i only need to get the data once in a single component. but since i rarely see it i wonder if there is a flaw in my thinking. What do u think is the best practice when it comes to this.
@CodeWithAhsan
@CodeWithAhsan 9 күн бұрын
@@alm-r4w great question. I think your approach is okay as well. however it requires a bit of care to not mess up. In the case of having the data in the service , you are still keeping the data in the service even if you’re not using it anymore. Or the purpose of the data has been fulfilled by being rendered on view. It will also make the testing a bit harder since your data is bound to your service . You won’t be able to mock it easily. The best practice I think it will be to receive the data from the API and to let it go, or save it into your state as required. In my opinion, request data, component state, and/or service variables shouldn’t be tightly coupled. The more isolation you have , the easier it is to perform unit tests.
@alm-r4w
@alm-r4w 9 күн бұрын
@@CodeWithAhsan Ok i think i understand, so if in need of reusing the data cross multiple components u would work with two sepperate services one for the api fetching and one for state management?
@CodeWithAhsan
@CodeWithAhsan 9 күн бұрын
@@alm-r4w Exactly!
@nebojsazakic
@nebojsazakic 23 күн бұрын
Until the signal resolves the value is undefined. Please use ?? instead of ||.
@CodeWithAhsan
@CodeWithAhsan 23 күн бұрын
Makes sense! Thanks 👍🏼
Real-Time Sentiment Analysis with Google Gemini & Angular
3:45
Code with Ahsan
Рет қаралды 184
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,4 МЛН
How To Use Imperva (2025)
1:16
HowToUnleashed
Рет қаралды 1
Signals Unleashed: The Full Guide
1:39:24
Rainer Hahnekamp
Рет қаралды 29 М.
Angular Crash Course | Learn modern Angular in 90 minutes
1:29:09
Code with Ahsan
Рет қаралды 17 М.
Angular v19 Developer Event
22:54
Angular
Рет қаралды 53 М.
Databutton: The Ultimate AI App Builder - Beats V0, Cursor & Bolt!
27:56
Code with Ahsan
Рет қаралды 1,1 М.
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 101 М.
Zoneless Angular Applications in V18
14:00
Deborah Kurata
Рет қаралды 20 М.
Why Angular Signals? Write Your First Signal
14:25
Angular University
Рет қаралды 15 М.
First Look at Angular's new resource() and rxResource()
11:38
Deborah Kurata
Рет қаралды 6 М.