adding angularjs code to control transitions