Converted angular code to coffee script