Learn Angular Signals - The Future of State Management

  Рет қаралды 21,390

Monsterlessons Academy

Monsterlessons Academy

Күн бұрын

Learn Angular Signals which is a new abstraction and alternative to NgZone and RxJS. This is a new way of setting and getting value which is available starting from Angular 16
TIMESTAMPS
0:00 Introduction
1:44 Using Angular Signals
3:31 Angular signals set method
5:25 Angular signals update method
6:07 Angular signals mutate method
6:40 Effects in Angular signals
7:47 Computed in Angular signals
8:39 My thoughts
► CHECK MY COURSES - monsterlessons-academy.com/co...
MOST POPULAR COURSES
► Building real project with Angular + NgRx - monsterlessons-academy.com/co...
► Building real NestJS API - monsterlessons-academy.com/co...
► Javascript interview questions - monsterlessons-academy.com/co...
► Building real fullstack project - monsterlessons-academy.com/co...
► Mastering Git - monsterlessons-academy.com/co...
► Mastering Docker and Docker Compose - monsterlessons-academy.com/co...
► Building real project with React Hooks - monsterlessons-academy.com/co...
► Building real project with Vue + Vuex - monsterlessons-academy.com/co...
FOLLOW ME
► TWITTER - / monster_lessons
► INSTAGRAM - / monsterlessonsacademy
► TIKTOK - / monsterlessonsacademy
REFERENCES
► Source code - github.com/monsterlessonsacad...

Пікірлер: 60
@Brendan2Alexander
@Brendan2Alexander Жыл бұрын
Helpful and concise thank u!
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad it was helpful!
@1306dk
@1306dk Жыл бұрын
I always look forward to your content. Any plans on getting in testing in Angular with Jest for example?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thank you for the idea. I will add it to the list of future videos.
@jsiahaan
@jsiahaan 10 ай бұрын
Great video! Thanks
@MonsterlessonsAcademy
@MonsterlessonsAcademy 10 ай бұрын
You're welcome!
@ajinkyachanshetty
@ajinkyachanshetty 3 ай бұрын
Amazing content!
@MonsterlessonsAcademy
@MonsterlessonsAcademy 3 ай бұрын
Glad you think so!
@gowthamp5612
@gowthamp5612 11 ай бұрын
For me,signal just looks like useState and useEffect in React,with more functionalities like mutable and compute.But,in my opinion change detection will easier and quicker by signals.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 11 ай бұрын
I agree. Looks like copy pasting ideas from React
@andres3665
@andres3665 8 ай бұрын
They are copying and pasting from solid.js@@MonsterlessonsAcademy
@MultiWarrr
@MultiWarrr Жыл бұрын
Sorry for out of context question, in ngrx can and should i update state from the backend service without any actions dispatched from from user (commercial platform) Thanks in advance
@waelm.elsaid295
@waelm.elsaid295 5 ай бұрын
Thank you very much for your valuable content , but i need to ask a question regarding the computed and specially for the example you used what the different between calling usersTotal() in the html template and calling users().length directly ? is there any advantage of using computed in this case ? and thanks again
@MonsterlessonsAcademy
@MonsterlessonsAcademy 5 ай бұрын
In this case not really. computed is some logic that you want to compute. Reading length has no logic so you don't need computed. It is also a good place for logic which you don't want to write in html.
@mugatu2017
@mugatu2017 Жыл бұрын
Excellent explanation
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad you like it!
@mugatu2017
@mugatu2017 Жыл бұрын
@@MonsterlessonsAcademy we have in rxjs multicast operators (BehaviorSubject - ReplySubject - AsyncSubject, EventEmitter) son we can achieve exactly the saqme as Signals
@nandhakumarappusamy9457
@nandhakumarappusamy9457 2 ай бұрын
Very helpful
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 ай бұрын
Glad you think so!
@SteDeus
@SteDeus Жыл бұрын
The video was very clear! I just didn't understand how effect works: how does it know to trigger when title is changed and not when users does? Does it trigger every time any signal change?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
As for now effect is called if any signal changes. I would like to see some api to trigger it only for specific signal similar to dependencies of useEffect in react
@luczztem
@luczztem Жыл бұрын
@@MonsterlessonsAcademy wow that's very weird...
@SteDeus
@SteDeus Жыл бұрын
@@MonsterlessonsAcademy Oh I see, I hope they give us a way to specify which effect should trigger or we have to make some custom shenanigans 😅
@baluditor
@baluditor Жыл бұрын
Effects will only run if any of their dependencies change, from the docs: Effects always run at least once. When an effect runs, it tracks any signal value reads. Whenever any of these signal values change, the effect runs again. Similar to computed signals, effects keep track of their dependencies dynamically, and only track signals which were read in the most recent execution.
@d1ge
@d1ge 3 ай бұрын
Signals are not just easier to grasp, than RXJS, but they are also closer to what's actually happening under the hood. - the fact alone, that your effect methods now can run sync instead of async, without frankensteining your ngOnChange method, is a feature in itself
@MonsterlessonsAcademy
@MonsterlessonsAcademy 3 ай бұрын
Yeap
@tarquin161234
@tarquin161234 Ай бұрын
At the moment I just don't really like the idea of making async things sync just by using toSignal with an arbitrary initial value. Sometimes, effects don't work as desired/expected when this arbitrary value comes in as the first value before the database value. For example, my effect needed to calculate a default value for a form field when it was null, so I did it in an effect, but the problem was this arbitrary value came in before the db value and so the wrong value was assigned to the form field. In my opinion, it is better to just wait for the database value, which means using rxjs instead of a signal. In my opinion it is better to use rxjs for async stuff, and use signals for sync stuff if you want, but for me I find it simpler to just use rxjs for everything.
@farrukhmomin5291
@farrukhmomin5291 Жыл бұрын
I really don't like the esthetics of signals. Code separation which ngrx offers make code base really clean. I hope angular team comes up with something which makes code looks cleaner.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
You can continue use ngrx and they will use signals underneath.
@bullettime2808
@bullettime2808 5 ай бұрын
you are comparing apples with oranges
@ismailuwair187
@ismailuwair187 3 ай бұрын
is it better in general to use signals instead of variables that are binded to UI for example?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 3 ай бұрын
Yes it is better.
@paweliszewski6575
@paweliszewski6575 Жыл бұрын
hello, what text editor are you using? love the channel
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
It's Vim here is my video about it kzbin.info/www/bejne/j6Ovmqidec12q80
@LukeAvedon
@LukeAvedon Жыл бұрын
Wow. Hey, really likeing your paid course my guy.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad to hear that!
@thorstenschmidt21
@thorstenschmidt21 Жыл бұрын
Hi, exists something like a benchmark? I learned that we should not call functions in Angular because it will make the app significantly slower. But with the signal you added a function to the view. How fast is it compared to older approaches?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
I didn't see any benchmarks or real app comparisons yet.
@baluditor
@baluditor Жыл бұрын
Calling signals is not like calling a function, it's perfectly safe to do. Calling a function is discouraged due to Angular's change detection mechanism, but signals won't trigger change detection like functions would in the template.
@thorstenschmidt21
@thorstenschmidt21 Жыл бұрын
@@baluditor thank you, I had a chance to look into angular 16 now too and I think you are right.
@mahdikamran8061
@mahdikamran8061 7 ай бұрын
Hello, Thanks for your videos. I have a question, are you from Germany? where are you from?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 7 ай бұрын
Hi, originaly from Ukraine but last 8 years living in Hamburg.
@fastestnotes1046
@fastestnotes1046 5 ай бұрын
I don't get it. Why can't we just use the ngModel directive with events? It doesn't make sense to use a variable like title as a method call.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 5 ай бұрын
ngModel works through change detection cycle and signals not. Change detection cycle is slow on big apps and signals not.
@L-Lesiv
@L-Lesiv 5 ай бұрын
So signals need only for not enter in life cycles, they are not accesible from other components like subjects?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 5 ай бұрын
You can put them in service and reuse everywhere
@L-Lesiv
@L-Lesiv 5 ай бұрын
Why do we need [value]="title()" in html if we change signal in event function?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 5 ай бұрын
Because we need to render a value in the input
@yaghuzt
@yaghuzt 10 ай бұрын
Hi, I am a bit confused, to me it looks like ngModel, whats the difference?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 9 ай бұрын
It doesn't trigger Angular change detection cycle. It is extremely fast in big apps
@riatec6741
@riatec6741 Жыл бұрын
Can we cancel a signal that has been created?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Why do you need to do that? It is not a subscription. It's the same like creating a subject. I doesn't cause performance problems.
@nobrainer616
@nobrainer616 2 ай бұрын
@@MonsterlessonsAcademywhy not just use the BehaviorSubject instead of signal? is there some other cases of signal usage that I’m missing?
@anutaNYC
@anutaNYC 4 ай бұрын
Target with a g as in girl not j
@chrisburd9751
@chrisburd9751 6 ай бұрын
I still think Rxjs is better than signals.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 6 ай бұрын
They are different
@chrisburd9751
@chrisburd9751 6 ай бұрын
@@MonsterlessonsAcademy I disagree - they both do state management, they both can interconnect components, and they both stream data the same way. In fact they are really no different than a behavior subject.
@pietrosmusi1409
@pietrosmusi1409 Жыл бұрын
they are copying from react and vue lol
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Yeap a bit
@maciej12345678
@maciej12345678 6 ай бұрын
@effectssss
Angular Signals. А точно ли нужен? Как работает магия сигналов
25:15
Архитектор ПО. Александр Желнин
Рет қаралды 8 М.
NgRx Signals Store - Is It a NgRx Replacement?
20:17
Monsterlessons Academy
Рет қаралды 9 М.
The joker's house has been invaded by a pseudo-human#joker #shorts
00:39
Untitled Joker
Рет қаралды 11 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Here's what I've figured out about Angular signals
8:33
Joshua Morony
Рет қаралды 13 М.
Angular 17 Features With Examples - You Must Know That
14:44
Monsterlessons Academy
Рет қаралды 36 М.
Rethinking reactivity with Angular Signals
10:57
Angular
Рет қаралды 19 М.
Новый быстрый красивый Angular 17
6:23
Миша Ларченко
Рет қаралды 17 М.
Angular Signals Example - Learn Them by Doing
50:50
Monsterlessons Academy
Рет қаралды 11 М.
Angular unsubscribe, Angular async pipe, RxJS subscribe - Avoid Memory Leaks
11:29
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 87 М.
The easier way to code Angular apps
9:54
Joshua Morony
Рет қаралды 64 М.
The joker's house has been invaded by a pseudo-human#joker #shorts
00:39
Untitled Joker
Рет қаралды 11 МЛН