dynamic template directive scope fix