I’ve written that I’m using Angular to write a couple applications before. One at my main contract and a couple side projects. I know I’m kind of late to the game, but one of my frustrations with the documentation around Angular is that very little of the sample code that you can find on the Internet shows the sample using anything close to a best practice. That’s the danger of writing about something you are too familiar with.
So, in this post, I’d like to cover a few best practices that I’ve discovered, or implemented in my own code, and explain in a bit more detail what is going on inside the controller. I concentrate on the controller because this is a place that will be used the most. Once you understand it, the rest of what you need to know will trickle down to services, factories, and directives.