replace angular events with  function where appropriate