Why I Chose AngularJS
My commercial project originally used a mix of jQuery and HTML forms. This resulted in messy code and markup, and I was quickly running into problems. For example, I needed to build a page where a user can create an order with any number of items. This is easy in ASP.NET MVC, but I couldn't use it because (to the best of my knowledge) it requires IIS and I was making a self-hosted app.Complex things are possible with JavaScript and HTML, but I did not want to solve a problem with an existing, good solution.
I looked at other JavaScript frameworks (I forget which specific ones) and thought that AngularJS would require less time to learn than the rest.
Working With AngularJS
AngularJS has quite a bit of functionality, but you don't have to use it all. My first pages that used AngularJS had a bit of data binding and a controller function. I was able to learn about modules, filters, services, templates, and other aspects of the framework as needed.The project also uses Razor templating. I was concerned that Razor might not work alongside AngularJS due to both using braces. AngularJS data binding works within Razor templates. In fact, all of my AngularJS templates also use Razor for permission checks and miscellaneous other activities that would be difficult to do on the client's side.
I'm having a bit of an issue with writing re-usable code, but that is due to my relative inexperience with JavaScript and not AngularJS itself.
There is one major flaw that I know of, and that relates to JavaScript minification. With AngularJS, it is easy to write code that doesn't work when minified. A section in step 5 of the official AngularJS tutorial covers some minification issues, but not all of them. When I have time, I'll try to put together a guide to creating minified code that uses AngularJS.
Why I Like AngularJS (So Far)
AngularJS allowed me to write well-organized JavaScript that handles complex models. It was relatively easy to learn, and I've experienced very few problems with it.June 27, 2014 update: I never got around to writing a guide for minification-friendly AngularJS code.
No comments:
Post a Comment