Several weeks ago, I introduced NgRX as a way to manage state in your Angular applications. You should think of that article as a basic “getting started” article. What I want to cover today is a better way of organizing you code that solves several problems with using NgRX the way I outlined in that article.
It isn’t so much that what I wrote is “wrong” just that it is incomplete. Today’s post is …
This past week I was talking to a guy who is graduating from College and looking for a job. He asked me what most people ask at that point in their career. “Everyone wants experience, but how do you get experience if no one will give it to you?”
What is interesting is that for all the advances in the 30 years since I started my career, that question is still the main question every graduate asks.
Now, before I get started, I want to make sure we are clear. These tips may or may not work for you. They are what I would do, and in large part are what I did 30 years ago, just updated to be appropriate to the current technology. How well they work for you are going to depend on a lot of different factors, not least of which is how much effort you apply. They are also very much based on my culture here in the USA. If you are looking for a job in another country that is dissimilar culturally, you may want to ignore this advice completely. But, I’ll also say this. If what you are currently doing isn’t working, what do you have to lose?
I’ve talked around NgRX several times over the last few months but I’ve yet to write an article on how to use NgRX. This is because I was under the impression that there were better articles available. And while there are a lot of articles available, there is not anything I feel comfortable sending another programmer to who is trying to learn NgRX.
So, rather than spend a lot of time on why you want to learn NgRX, or arguing against some of the unfounded hesitations, today I’m just going to dive into how to use NgRX.
This past week, I ran into a need to dynamically add components using Angular. My specific reason for doing this is that the component I am using is a port of an AngularJS component and so it doesn’t quite conform to the Angular way of doing things. Specifically, I can’t change input values and have the component respond reliably. But, regardless of why I need this functionality, or even why you may need this functionality, I think being able to do this at all is pretty cool.