directive with template function