working ng based pagination
fix bug in last page of pagination