dry out angular code