« Back to home

One More AngularJS Application

Posted on

I am nearing completion one more non-trivial application using AngularJS. I really like the way it turned out. There were a couple small problems along the way, but I feel that AngularJS is a very good framework and there is a lot of momentum in the AngularJS world.

Full AngularJS app, well almost

My goal was to fully implement this application in AngularJS using REST based services for all server interaction. I accomplished this with one exception: login. Unfortunately, some (all?) browsers only recognize credential auto-completion on form submission. AngularJS intercepts the form submission, so if your application is using AngularJS on the login page browsers will not recognize that a login is taking place and will not prompt users to remember their credentials.

The solution I used was a simple form based authentication page that submitted to the server and set authorization and session cookies appropriately. It felt like a step back technology-wise, but that is only a small piece the site.

Form validation ugliness

The form validation for my small application does seem a bit unwieldy. There were two parts that bothered me. First, the markup itself is pretty verbose. Second, there was a small amount of code duplication in the controllers. I was working on this project alone, so I think it would be useful to see what approaches other people have taken to this problem.

I could have used some AngularJS directives to clean up the HTML markup a bit, but I was more concerned with the controller code.

Hello Protractor, it is nice to meet you

I used Protractor for my end-to-end testing and it was great. Protractor and Jasmine seem pretty decent so far. The only surprise I had was when a Jasmine expectation fails, execution of that test continues. That was a bit unexpected, but was not a huge problem.

Goodbye CoffeeScript

I have used CoffeeScript in previous projects, but with this project I decided to use straight JavaScript. Of course JavaScript has a bit of syntactic noise, but it actually felt cleaner to use JavaScript. I like the terseness of CoffeeScript, but I’m not sure I see a significant advantage over plain old JavaScript.

In my end-to-end testing I used a little bit of TypeScript and it worked surprisingly well. I might look into using more TypeScript in the future.

Next Steps

With this application nearing completion it is time to re-assess my current situation and take some meaningful steps forward. Hopefully, that will include posting more than once every couple months and some open source work.

Comments

comments powered by Disqus