Angle-based wavefront sensing enabled by the near fields of flat optics