handling events with directives.