Learn Angular Signals RxJS Interop From a Practical Example

  Рет қаралды 3,473

Code Shots With Profanis

Code Shots With Profanis

Күн бұрын

Пікірлер: 28
@akitoueu
@akitoueu Жыл бұрын
It's a good way to do it, but you can make it simple by doing this: userId = signal(undefined); posts$ = toObservable(this.userId).pipe( debounceTime(200), switchMap((userId) => this.postsService.get(this.userId())) ); posts = toSignal(this.posts$); You don't even need the behaviour subject or the effect.
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
That's a good alternative. Thanks for sharing that!
@sampsonorson
@sampsonorson Жыл бұрын
Why are you using the userId signal within the switchMap?
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
​@@sampsonorson It seems to be more like a typo private posts$ = toObservable(this.userId).pipe( debounceTime(500), switchMap((userId) => this.postsService.get(userId)) );
@andresescorcia6587
@andresescorcia6587 Жыл бұрын
To do this, so what is the meaning of using signals ??? You have to change the chip, create your debounce method, and that's all. The correct way is the effect shown in the video, let die RXJS,
@joaobentocandidobezerra6486
@joaobentocandidobezerra6486 4 ай бұрын
The first one that gives an actual full view example on signals and http request. Was looking for something like this the whole day, thank you for that!🥰
@luigidicarmino5849
@luigidicarmino5849 Жыл бұрын
As always, a great overview and solutions on how signals can be used. More of them, please. Thanks for your great summary. 👍
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
Glad you liked it! Please feel free to suggest a use case where you would love to see how the Signals can be used
@wiliamferraciolli5380
@wiliamferraciolli5380 10 ай бұрын
just trying it out and got to the point where the toSignal function will create a read only Signal and not a WritableSignal so need to change it around a bit, but thanks for the tutorial, good explanation
@aram5642
@aram5642 Жыл бұрын
Would you kindly consider making a video about SSR and hydration?
@Nabulio85
@Nabulio85 Жыл бұрын
Great explanations. Thank you for sharing your knowledge
@ugochukwuumerie6378
@ugochukwuumerie6378 Жыл бұрын
Great video. What extension was used to label your parameter name and arguments?
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
Thanks! It's not an extension, it's this VSCode setting "typescript.inlayHints.parameterNames.enabled": "all"
@giorgoskontis7185
@giorgoskontis7185 Жыл бұрын
Amazing job as always!!
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
Oh thank you!
@safiyudeen-m4f
@safiyudeen-m4f 11 ай бұрын
Could you tell me why do you put token inside the inject function please?
@maciek77killer
@maciek77killer 10 ай бұрын
Hi, how can I typing posts: posts: Signal = toSignal() throw error, I can add Signal but it is good practice?
@sanjivasen
@sanjivasen Жыл бұрын
You are super star my friend
@ridvancetin8393
@ridvancetin8393 Жыл бұрын
Hi, Fanis I'm Ridvan from Anixe; It's a good example for rxjs and signals as a real-world example. But it's looking like a bit nonreadable when there is more than one object 🤔
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
Can you elaborate a bit more? What do you mean by saying "when there is more than one object"?
@ridvancetin8393
@ridvancetin8393 Жыл бұрын
@@CodeShotsWithProfanis I mean if I have another signals in the same component it will look a bit complex I think
@g-luu
@g-luu Жыл бұрын
I appriciate your videos but i am starting to doubt signals. Everything just looks like a mess and i dislike imperative code. The pinned comment makes it a lot cleaner but still though dont think im conviced signals are the future.
@TayambaMwanza
@TayambaMwanza Жыл бұрын
I've been using signals + rxjs for a couple weeks now, I believe it's the future, right now I have no more async pipe in my templates and that is really cool, no more ng-container + asynx just to create the normal variable and get the data.
@additionaddict5524
@additionaddict5524 Жыл бұрын
Imo, video is a bad example. Signal advantages are simple glitch free reactivity and ability to create computed properties. A typeahead is a clear cut case for using RxJs.
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
Thanks for your comment Bryan. Since Signals is all new to all of us we are learning new techniques/approaches. Are you saying that you prefer working with RxJS or do you have a different signals API in mind?
@CodeShotsWithProfanis
@CodeShotsWithProfanis Жыл бұрын
​@@additionaddict5524 I appreciate your comment! I believe the pinned comment suggests a better way of approaching this use case. Apart from the computed properties, the signals also offers a better change detection. If you would have to go with RxJS, you would have to use async pipe on the template. If you have something else in mind, please do share. We are all on the same boat trying to get things done on the right way ;)
@additionaddict5524
@additionaddict5524 Жыл бұрын
@@CodeShotsWithProfanis Should say, video is still useful, I would just do it differently. “Bad example” is no reflection on you. In fact I think trying /seeing this without RxJS is needed to understand boundaries of where signals do well and where RxJs should take over
Angular Signals. А точно ли нужен? Как работает магия сигналов
25:15
Архитектор ПО. Александр Желнин
Рет қаралды 9 М.
Unlocking the Power of Angular Signals + RxJS: Practical Applications
16:24
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 18 МЛН
这到底是怎么做到的 #路飞#海贼王
00:10
路飞与唐舞桐
Рет қаралды 4,2 МЛН
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 17 МЛН
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 83 МЛН
Learn How to Use Angular's 17 Defer Block
23:50
Code Shots With Profanis
Рет қаралды 4 М.
Get to Know Signal Queries in Angular 17
17:43
Code Shots With Profanis
Рет қаралды 1,8 М.
Learn How to Unit Test Angular Components with RouterTestingHarness
29:54
Code Shots With Profanis
Рет қаралды 2,8 М.
AMP 62: Mark Thompson on Angular 19+
19:15
NG Poland Conf
Рет қаралды 2,1 М.
Local Change Detection in Angular is easy with Signals
10:40
Code Shots With Profanis
Рет қаралды 2,5 М.
Angular Scroll Position Restoration
15:21
Code Shots With Profanis
Рет қаралды 6 М.
Are you using Angular Signal Effects in the RIGHT way?
11:13
Zoaib Khan
Рет қаралды 2,3 М.
Learn How to Use Angular's 17 Signal Inputs
3:48
Code Shots With Profanis
Рет қаралды 2,7 М.
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 97 М.
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 18 МЛН