michaelbromley / angularUtils

A place where I will collect useful re-usable Angular components that I make
MIT License
2k stars 858 forks source link

dirPagination: range.lower is 1 when range.total == 0 #433

Open sasham43 opened 7 years ago

sasham43 commented 7 years ago

range.lower is 1 even when the collection is empty, so when using a custom template it displays 'Showing 1-0 of 0'

https://plnkr.co/edit/FHqqsJRVPrp50CAobTld?p=preview

michaelbromley commented 7 years ago

Thanks for the report.

If anyone wants to have a go at fixing this, comment below. Honestly I have little time right now to work on this.

GLoganDR commented 7 years ago

I am basically having this exact problem!

I have an array of items with detail data for each item displayed. When deleting the item objects from the array, it deletes all of them, but it does not delete the last one from the view model. It is gone from the data, but it's being held onto by something in the dirPaginate directive.

When I replaced dir-paginate with ng-repeat, I was able to verify that it is, in fact, working as expected, but something appears to be preventing it from reflecting that the last item was deleted. This is the closest issue I have seen to match the behavior I am witnessing on my end. My friend said something about it being related to the way $compile is being done?

florentino commented 6 years ago

hi @sasham43 see my workaround.

https://plnkr.co/edit/9zqhQuRHifqkqQ92P4Lw?p=preview