Refactoring angular code.