Coding exercise using AngularJS