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

preview_player
Показать описание
Learn how to use Angular 19's powerful resource and rxResource methods to simplify data fetching in your Angular applications. This tutorial covers everything from basic setup to advanced error handling and RxJS integration. Whether you're new to Signals or an experienced Angular developer, this video will provide valuable insights and practical tips.

Timestamps:
00:00:00 - Introduction to Angular Signals and Data Fetching
00:01:12 - Project Overview: Linked Signals Example
00:02:25 - Code Walkthrough: Components, Services, and Signals
00:04:57 - Refactoring with resource: Simplifying Data Retrieval
00:06:20 - Typing with Generics: Ensuring Type Safety with resource
00:08:00 - Error Handling with resource: Graceful Degradation
00:11:20 - Demo: resource in Action (Network Throttling Example)
00:13:40 - Exploring rxResource: Integration with RxJS Observables
00:16:40 - Comparison: resource vs. rxResource - Which One to Use?
00:18:30 - Code Cleanup: Conciseness and Readability
00:19:30 - The Future of Signals and Data Fetching in Angular
00:20:45 - Using the Angular Cookbook for More Advanced Examples
00:21:30 - Conclusion and Next Steps
Рекомендации по теме
Комментарии
Автор

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...

arpitgarg
Автор

Value is T|undefined because the value is undefined until the loader resolves (or when a new request kicks off)

tjlav
Автор

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.

alm-rw
Автор

Until the signal resolves the value is undefined. Please use ?? instead of ||.

nebojsazakic