changed structure of code to demonstrate ng-click directive