change pagination to directive