modified to support angular js custom directives