Angular directive support and some sort of optimization