coding exercise in AngularJS