Added attached/detached callbacks for directives