Rearrange some angular pagination code, update ranges after query updates