I wrote an article not that long ago addressing my impressions of Angular.js. Today I want to talk to you about how my feelings have changed after working on my first production Angular.js application.
Angular.js is a very powerful tool for the front end developer, especially one who understands the back end. I have been working with both for over 20 years now, so it seemed like the perfect tool.
I was brought into this project with the Los Angeles Superior Court from the start and Angular.js was the technology chosen by the court staff. I went to work creating a nice UI using Bootstrap (another of my favorite tools). As I got deeper into the requirements I was also expanding my knowledge of Angular.js. I began to familiarize myself with the real world problems faced by those who develop with Angular. However, as I am coming out the other side with an application that is in very good shape right now, i have the following things to say.
The Model is Everything
Angular bases everything it does with data off of models. The two-way binding between the front end and the model is extremely powerful. Saving data selections that would have taken many lines of code in previous applications took 3 or 4 lines. When I finally truly grasped the link between the model and having control over not only the front end, but the back end as well, things sped up.
The biggest learning about the model was when I was having problems with a scrolling issue. I wanted to show a div or hide that div based upon interaction with a user. I managed to make that work, but then I had issues with the selection at the bottom of the screen not showing without forcing the user to scroll. I introduced the ability to scroll that into view, but because Angular does some funky things with reporting of div positioning, I ran into more problems. I finally solved them by adding a RowID to the data as it is returned and using that I was able to accomplish the task at hand.
Not Everyone Does it the Same Way
In working through this project I had to do a lot of searching on Google. I used Stack Overflow a lot. What I determined is that for some things there are just many solutions and you have to pick the one that works best for you. Not everyone does things the same way. I see people declaring things as “standards” when really they are not standards, they are personal preferences. Getting past all that was a huge learning for me as well.
JQuery CAN Be Used With Angular
There are a few instances in my code where JQuery is integrated into the process. I don’t change the DOM or anything drastic like that with JQuery (relying instead on the model), but JQuery definitely has its purpose in an Angular application. I can hear many of you gasping! Well, I said it and I stand by it.
I am still learning Angular.js, but I have been enjoying my very first foray into a production environment with it. It is powerful, but it definitely should not be used for every application like some people might think. If you haven’t messed with it yet, give it a shot. See what you can do with it.