strange, why should the template know about the subscription logic? why should there be any calculations in the template at all? I mean | async... why should the logic for collecting and processing presentation model data be spread out everywhere, both in the class component and in the unfortunate template... a strange recommendation after more than 10 years in development..
" | async " is not a calculation. It's a very well-known best practice in the Angular space. Note that the template doesn't know about subs / unsubscriptions; the pipe does. Could it be better? Yes, and that's why we have Angular Signals now.
@@alcfeoh using anything other than simply fetching a field from a data provider is a dependency, first | async, now list.data(), interestingly, by the end of the next century we will be able to simply select fields like state.list in templates without worrying about implementation..
Click here to read the full blog post: nuel.ink/IvRfkZ
29 дней назад
Can we get the source code of the example used in this workshop @RainerHahnekamp? I am interested in assertDefined(question) technic, thank you so much.
Hi! Thanks for such a great content, SignalStore is very powerful, but i cant figure out how to solve a complex scenario without using actions or without injecting all services inside the store. I'll try to create an example (a bit forced, but it's just to create some complexity). U have this function that takes a response to a quiz and validates it online, in base of response u have to interact with the UI and decide what to do: ``` 1. U submit a quiz response to an API <-- inject API service 2. If the response is 'correct': 2.1 update the store 2.2 notify it to user (via a notification service) <-- so U have to inject this service 3. If the response is 'wrong': 3.1 ask user if he wants to try again <-- here u need another service to or something else to pause the pipe and wait for user response 3.2 If NO: 3.2.1 update the store 3.2.2 notify the wrong answer 3.3 If YES: 3.3.1 update the store 3.3.2 notify the right answer ``` This way the store becomes a garbage dump, is there any pattern to avoid this?
It's not the store's job to notify the user. You can keep the store focused on updating the state and have some sort of facade service that calls the store and then sends notifications. That way, such a service is never injected into the store. You don't want to tie UI features into business logic.
@@RomanMatkivskyy Yes, though it's not different from any regular Angular service. There are quite a few videos on the facade pattern with NgRx including this one from Rainer: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-K4dpVXuhm14.html
Great workshop! Just went through figuring out a similar process at my work with migration to Angular 18, and it's very nice to see some areas for improvement.
Nice. 5:03 i hadnt looked at v17 but was hoping to see a template as simple as Razor syntax in Angular. Good job! It is disappointing the constant use of the @ symbol though hopefully thats not becuz of MS 🤨
It was removed at the end of the developer preview. Probably for performance reasons or just to simplify the API further. update() is plenty enough to mutate an object, though we have to return a copy of it for everything to work properly.
Awesome!!! Sir Please make a complete series on Angular. Really it will be a good step for beginners who want to learn Angular. And also make some practice based projects. I hope that you will make this....... waiting for your response.... Best Wishes for you!
hi friend u have basic training video should be free on youtube you will get more subscribers to achieve to success and proceed to payable training is good