Тёмный

🚦 Angular NgRx Signal Store Crash Course (For NgRx Beginners) 

Angular University
Подписаться 50 тыс.
Просмотров 21 тыс.
50% 1

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 109   
@AngularUniversity
@AngularUniversity 7 месяцев назад
This is what the future of Angular is starting to look like: Signals, no RxJs, async / await, Promises 😊No music after the intro as requested, enjoy everyone 😉
@g3co875
@g3co875 7 месяцев назад
no RxJS?, why ? Thanks for all the latest videos!, btw
@AngularUniversity
@AngularUniversity 7 месяцев назад
It's not needed for most cases when writing asynchronous code. The Angular team is making RxJs optional, it should become much less used in the Angular world in the future. 👍
@DennisFeher
@DennisFeher 6 месяцев назад
RxJs is here to stay. Where are you making your claims from? You're assuming stores are the way of application development it's a thing invented to solve the pain of react apps. NO OTHER FRAMEWORK NEEDS IT.
@TW-go8wz
@TW-go8wz 6 месяцев назад
@@AngularUniversity Do you have a source that Angular team wants to make RxJs optional? At least if you make http requests with the HTTP Client you would need to call lastValueFrom (from rxjs) to make it a Promise.
@TW-go8wz
@TW-go8wz 6 месяцев назад
@@AngularUniversity Do you have a source that the Angular Team wants to make RxJs optional? This would mean that they will change e.g. the HttpClient as well to be Promise based. Would be a huge breaking change.
@nidinpereira5898
@nidinpereira5898 7 месяцев назад
Nice tutorial, but injecting the service in the store and store in the service considered anti pattern. Won't it lead to cyclic dependency errors. Also although it's perfectly fine to use async await, feels illegal seeing it in angular 😅
@AngularUniversity
@AngularUniversity 7 месяцев назад
Thank you, async/await works perfectly in Angular, it always has, and the framework has great support for Promises. The official docs of NgRx Signal Store use also async/await ngrx.io/guide/signals/signal-store 😉 So it's not that illegal after all 😂
@mohamedaraba4028
@mohamedaraba4028 5 месяцев назад
Hello Vasco thanks a lot for this tutorial 👍 Could u put the link of github repo thanks
@cbjerg
@cbjerg 5 месяцев назад
How do you work with store on a more complex application, where you would work with more than todos. Like users and auth and such. Do you keep it in the same store, or would you generate a store for each component?
@AngularUniversity
@AngularUniversity 5 месяцев назад
In principle you put everything into one single centralized store. The store can be split up into features ngrx.io/guide/signals/signal-store/custom-store-features
@ddgutierrez
@ddgutierrez Месяц назад
tnks for all! Man i have a question, we can use the hooks for init the store or is bad practice? another question! what is the best way or the best practice for prevent fetch data 2 times i mean, if i know my store is data will never change how i can prevent the fetch if alredy exist data ?
@JohanVrolix
@JohanVrolix 6 месяцев назад
Ha! ProvidedIn: root proved necessary using the store across different components. Is there a way to make the store perpetuate within providedIn: root?
@AngularUniversity
@AngularUniversity 6 месяцев назад
Hi Johan, provided in root makes the store a global singleton, meaning it can be injected anywhere. I didn't understand the last part though, about the store perpetuating, what did you mean?
@JohanVrolix
@JohanVrolix 6 месяцев назад
@@AngularUniversity hi Vasco, basically can you have it persist between different components without providedIn root?
@AngularUniversity
@AngularUniversity 6 месяцев назад
@@JohanVrolix Yes, if you put in the providers array of a parent component, that instance will be seen by the parent and the child components. If you put it into the application root component, it's almost the same as putting it in the root of the dependency injection system with providedIn root.
@AngularUniversity
@AngularUniversity 6 месяцев назад
but using providedIn root is recommended to a global store, this way you are 100% sure that you can inject it anywhere.
@JohanVrolix
@JohanVrolix 6 месяцев назад
@@AngularUniversity thanks so much for the swift response and the great insights. I’m nearly finished with my first Angular app using SignalStore now
@jeffleigh5291
@jeffleigh5291 6 месяцев назад
Vasco, what would be very helpful is how to use Firestore as a backend with signal-store
@AngularUniversity
@AngularUniversity 6 месяцев назад
Thank you for the idea. 👍
@Official-p5c
@Official-p5c 2 месяца назад
I am using rxMethod and now I need to use it in component. and after getting success api response I need to perform some action based on data.. how to do that ? Not able to understand
@Marbulinek
@Marbulinek 5 месяцев назад
Great learning video Vasco!! I really enjoy your channel. Everything is fine for me, but I have one question about signal store metods: you are using in demo async/await for asynchronous data retrieving. Maybe idea for next quick video, angular team (in angular.dev) is strongly supporting rxjs for asynchronous data retrieve. Can you do some really really simple example of using this construction instead of simple async/await? Thanks, Lukas
@AngularUniversity
@AngularUniversity 5 месяцев назад
The Angular team is not strongly supporting the use of RxJs, by the contrary it's saying use it if you really need it, explore other options, don't use RxJs as a default mandated best practices, RxJs is optional that is the message of the Angular Team. You can check out here my latest video on the channel for more details - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-uOIdILz-Dkw.html 👍
@nergrohombre
@nergrohombre 4 месяца назад
Half way through and I am wondering why the PROMISE and not observable from an HTTP client, maybe there is something I don't see. I will keep watching. I assume you have a more in depth class for this and will watch it, I will never simulate a service like that, but I get you are trying to move fast. I probably will come back and apologize.. LOL, let me watch the whole thing!
@AngularUniversity
@AngularUniversity 4 месяца назад
Promises are well supported in Angular together with the async/await syntax. It's a wonderful alternative to RxJs when it comes to HTTP.
@jeffnikelson5824
@jeffnikelson5824 2 месяца назад
How do you access route parameters from such a service ?
@fuldrew-schodyrzeszowstalo7625
@fuldrew-schodyrzeszowstalo7625 Месяц назад
Do you have repository to look add the code?
@ricardomiguel7242
@ricardomiguel7242 3 месяца назад
Why do we need the effect type in constructor (filtering part) and what would happen if i didn´t wrap that code into effect function ? Thanks.
@AngularUniversity
@AngularUniversity 3 месяца назад
Effects can be put in other parts other than the constructor, like on ngOnInit, but you need to pass it an injector explicitly. The recommended pattern is to put it in the constructor, to keep things simple. 👍
@JuanPreciado-l5j
@JuanPreciado-l5j Месяц назад
Do you have source link?
@JuanPreciado-l5j
@JuanPreciado-l5j Месяц назад
Did you generate a repository?
@bobyuan5475
@bobyuan5475 6 месяцев назад
Thanks for this amazing ngrx signal store tutorial. one question, how do i use store in multiple components? my understanding is the store is injected at root level, that means available to all components, i simply inject the store to multiple components, that works, but the issue the store state update is not reflect in a other components. am I missing something?
@AngularUniversity
@AngularUniversity 6 месяцев назад
Thank you, I'm glad you enjoyed it 😉 Correct, the store usually is a singleton, in my example I used provided in root. you can inject it anywhere. If you update the store state, it will be reflected in all components that consume store signals 👍
@TW-go8wz
@TW-go8wz 6 месяцев назад
Hey Vasco, thanks for this great tutorial. Can you make a video where you explain and use the rxMethod in the signalStore?
@AngularUniversity
@AngularUniversity 6 месяцев назад
You're welcome, I'm glad you enjoyed it! 😊 Yes, I'm thinking about coveting rxMethod sometime soon here on the channel. 👍
@lindermannla
@lindermannla 4 месяца назад
The best content for Angular developers! Thnxz!
@AngularUniversity
@AngularUniversity 4 месяца назад
Thank you, please enjoy. 😊
@ScottSchafer-qz1tf
@ScottSchafer-qz1tf 6 месяцев назад
Hi Vasco, Will you be offering the source code for this project, it would be great if you did. Thanks for all you do!👍👍
@iantaite
@iantaite 26 дней назад
Great tutorial. Much clearer than the official documentation.
@marcodigennaro5753
@marcodigennaro5753 7 месяцев назад
Hello Vasco, I noticed that triggering the insertion of a Todo also triggers the update of the Store. This causes the strange behavior that, if there is a completed item in the list, the last inserted todo will also be considered completed. Isn't that strange?
@mattthedude1
@mattthedude1 7 месяцев назад
I've been able to track down a few other similar behaviors as well. Switching to completed, toggling a todo, and switching to pending or all will mark them all as completed. If you're quick enough, double clicking a todo will start an infinite loop. It does seem to be coming from the MatSelectList, don't know if this is a broader issue or specific to the signal interaction.
@AngularUniversity
@AngularUniversity 6 месяцев назад
Thank you for reporting everyone. I had a look at it this morning, simply replace the Angular Material selection list with plain HTML and a checkbox and it works. So something to do with the use of that particular material component. So it's not a broader issue.
@marcodigennaro5753
@marcodigennaro5753 6 месяцев назад
@@AngularUniversity thanks
@AngularUniversity
@AngularUniversity 6 месяцев назад
@@marcodigennaro5753 You're welcome 👍
@StephenWitter-i4g
@StephenWitter-i4g 7 месяцев назад
Is there a specific reason you are using types over interfaces for your models?
@AngularUniversity
@AngularUniversity 7 месяцев назад
I just like the keyword "type" better instead of interface, it describes better what I'm trying to define. 👍
@marijnstapert9036
@marijnstapert9036 7 месяцев назад
You also can't do exclude of an interface, so you need a seperate model for your DTO and presentation model
@AngularUniversity
@AngularUniversity 7 месяцев назад
@@marijnstapert9036depending on the complexity of the domain model, a separate DTO model and the mapping involved is often not necessary.
@estevaoterci
@estevaoterci 4 месяца назад
Great Vasco, Great! Dark theme ❤
@DraaElMizan
@DraaElMizan 7 месяцев назад
Hi Vasco, why don't you update the Udemy course. I've purchased your NGRX course and It will be nice it you can upate it.
@AngularUniversity
@AngularUniversity 7 месяцев назад
I plan to update it with a much more in-depth dive into NgRx Signal Store, including entities, features, etc.😊
@KiffinGish
@KiffinGish 6 месяцев назад
I see that sometimes you use double equals '==' instead of tripe equals '==='. Isn't it best practice always to use triple equals?
@AngularUniversity
@AngularUniversity 6 месяцев назад
You can if you want, in principle it's better. But I'm yet to run into a case where it made a difference. 😊
@nelson3391
@nelson3391 2 месяца назад
Thanks a lot!
@josephsackeykontor4138
@josephsackeykontor4138 2 месяца назад
Thanks a lot for this video. You really nailed the explanation.
@AngularUniversity
@AngularUniversity Месяц назад
Thank you. Stay tuned for more videos!
@dacstudy
@dacstudy 6 месяцев назад
thanks. simple and clear! This is gold for everyone!|
@AngularUniversity
@AngularUniversity 6 месяцев назад
You're welcome, I'm glad it helped. 👍
@wiliamferraciolli5380
@wiliamferraciolli5380 6 месяцев назад
thanks for the tutorial, do i need angular 17 for it? is it still in beta the ngrx store?
@AngularUniversity
@AngularUniversity 6 месяцев назад
You're welcome 😊It's based on signals so it need 17, maybe it works with 16. It's not in beta it's in developer preview; It means that's ready but things might still change a bit.
@andr3ignacio
@andr3ignacio 6 месяцев назад
What extension are you using to auto import the material components??
@AngularUniversity
@AngularUniversity 6 месяцев назад
This is Webstorm, there is no extension. I'm hitting Alt Enter to import, and sometimes the imports happen without intervention.
@YossefMagdy-n8z
@YossefMagdy-n8z 2 месяца назад
Thanks a lot for the great explanation and effort.
@AngularUniversity
@AngularUniversity 2 месяца назад
Thank you!
@termobin
@termobin 5 месяцев назад
Another great job Vasco!! Thank you so much for this tutorial!!!
@AngularUniversity
@AngularUniversity 5 месяцев назад
Thank you I'm happy to hear that 👍😊
@rembautimes8808
@rembautimes8808 5 месяцев назад
Watched it the whole way through. Great content , hope you’re a Madrid fan 🎉
@CasualTramp
@CasualTramp 6 месяцев назад
Wow thanks a lot ! You won a new follower
@AngularUniversity
@AngularUniversity 6 месяцев назад
Thank you and welcome to the channel 😉
@zeynalalakus4540
@zeynalalakus4540 7 месяцев назад
Thanks a lot for the great explanation and effort. 🎉
@AngularUniversity
@AngularUniversity 7 месяцев назад
You're welcome, enjoy the videos 😊
@assaf2141
@assaf2141 7 месяцев назад
This is once again a great tutorial!
@AngularUniversity
@AngularUniversity 7 месяцев назад
Thank you 😊
@AntonioSantana-ll8il
@AntonioSantana-ll8il 7 месяцев назад
Excellent video!!!
@AngularUniversity
@AngularUniversity 7 месяцев назад
Thank you very much! 😊
@rishimondal3010
@rishimondal3010 6 месяцев назад
Can you integrate local storage?
@AngularUniversity
@AngularUniversity 6 месяцев назад
That's a great question, and yes sure. Right now there is no plugin for it, bit it's quite easy to do that with an effect to save the state to storage, and load it back at application startup. 👍
@rishimondal3010
@rishimondal3010 6 месяцев назад
@@AngularUniversity can you please provide a example snippet, it will help a lot, current I am working on a login /sigin up page using firebase as backend. But after login, when I refresh it , it automatically log out the user . Plz help me on this
@renaisancijf
@renaisancijf 5 месяцев назад
why we put the effects in the constructor instead of OnInit ?
@AngularUniversity
@AngularUniversity 5 месяцев назад
Very good question, by default they won't work on ngOnInit because it's outside an injection context. you can still pass it an injection context if needed. In general with angular signals we are going to be using the constructor a lot more. 😊
@renaisancijf
@renaisancijf 5 месяцев назад
Obrigado Vasco e congrats por sempre trazer novas atualizações ;)
@AngularUniversity
@AngularUniversity 5 месяцев назад
@@renaisancijf Obrigado 😉
@johnparlato8737
@johnparlato8737 7 месяцев назад
Can we view the source code for the project?
@AngularUniversity
@AngularUniversity 7 месяцев назад
Yes, thank you for reminding me I've added the link in the description. here it is github.com/angular-university/ngrx-signal-store-crash-course
@ScottSchafer-qz1tf
@ScottSchafer-qz1tf 6 месяцев назад
@@AngularUniversity The repository link does not seem to be working. Is there another place like a blog post that I could find the source code?
@steX1
@steX1 6 месяцев назад
is the repo private?
@rs4267
@rs4267 7 месяцев назад
why using promises instead of observables ? by the way thanks for your course; i hope to learn new things !
@sulaimantriarjo8097
@sulaimantriarjo8097 7 месяцев назад
I wonder too. I think its better to combine it with observable
@AngularUniversity
@AngularUniversity 7 месяцев назад
It's way simpler, no need for RxJs for writing most code; It should only be used if really needed, not for every day async code. 👍
@AngularUniversity
@AngularUniversity 7 месяцев назад
For most cases, aync / await works just fine. 👍
@g3co875
@g3co875 7 месяцев назад
what scenarios / quick examples would you consider as 'mandatory' for using RxJS ? Thanks for your time!@@AngularUniversity
@AngularUniversity
@AngularUniversity 7 месяцев назад
@@g3co875 I don't think there are any in practice, for most applications. Things like cancellation and auto-complete search boxes which are the typical examples can be done via reusable libraries or widgets, some of which could internally even use RxJs if needed, but there is no need to use at the level of the application for doing simple things as HTTP, in my view. 👍
@bonnes04
@bonnes04 6 месяцев назад
Great video. I think it's better to use real API, so we can see how to deal with Observables in signal store
@AngularUniversity
@AngularUniversity 6 месяцев назад
A real API can be queries using Promises as well, it works just the same. You can use fetch, the HTTP client and convert the Observables to Promises, or use tRPC or some other more sophisticated HTTP client.👍
@tdekoekkoek
@tdekoekkoek 5 месяцев назад
@@AngularUniversity why convert to promises though? Can't you just convert from observables to signals? I would prefer to keep my services as observables as that maintains what I have been doing pre-signals. This keeps it flexible IMO
@AngularUniversity
@AngularUniversity 5 месяцев назад
@@tdekoekkoek Personally I think Promises are a better fit for async tasks like HTTP, that's what they were designed to do. For most applications, no event orchestration is needed so RxJs is overkill. Returning signals from the service layer, I'm not sure about that because what about error handling?
@tdekoekkoek
@tdekoekkoek 5 месяцев назад
@@AngularUniversity thanks for your explanation. No I wasn't suggesting returning signals from the service layer, just observables and that keeps my service layer the same while introducing Ngrx Signals
@AngularUniversity
@AngularUniversity 5 месяцев назад
@@tdekoekkoek The official docs of Ngrx Signals suggest to use async/await, personally I think it's a better approach and i suggest that you give it a shot, but if you want to return Observables that works too, there is a full interoperability. Myself these days i only use RxJs if I really need to, for most typical day to day operations I find it unnecessary and prefer the clarity, simplicity and readability of async/Await.
@sickboy1776
@sickboy1776 4 месяца назад
why don't you work on your accent? you've been recording videos for years now but you're talking with the same accent as 10 ten years ago! how can you not make any progress in that?
@AngularUniversity
@AngularUniversity 4 месяца назад
LOL people seem to understand most of what I say 😉
@meisterthea
@meisterthea 2 месяца назад
@@AngularUniversity Your accent, pronunciation is absolutely fine. Don't change anything!
@zbajro
@zbajro 20 дней назад
Hi this accent has become as a brand so don't change it. Its perfect as soon as users hear it, it knows it's going to be great content! Thanks!
Далее
NgRx Signal Store Trilogy, Part 1: Why, When, and How?
51:04
FATAL CHASE 😳 😳
00:19
Просмотров 1,3 млн
Bearwolf - GODZILLA Пародия Beatrise
00:33
Просмотров 140 тыс.
🚦Angular Signals Game Changer: NgRx Signal State
11:38
NGRX Signal Store with Manfred Steyer
1:10:48
Просмотров 8 тыс.
Why Angular Signals? Write Your First Signal
14:25
Просмотров 11 тыс.
Angular Crash Course 2024 (for Beginners)
4:04:23
Просмотров 161 тыс.
NgRx Signal Store: The Release
46:35
Просмотров 6 тыс.
Here's what I've figured out about Angular signals
8:33
NgRx Signal Store - Is It a NgRx Replacement?
20:17
Просмотров 10 тыс.