Change directive to work in a more angular way