Add event handlers to directive

Also, add data attribute to directive for storing text.