Fix bug with preventDefault inside $apply