How to disable infinite-scroll?


#1

How can we disable infinite scrolling once available results are empty? With the example I set $canScroll to false when next returns an empty response.

<ion-content scroll="{{$canScroll}}">
<ion-list>
	<ion-item ng-repeat="thing in things">
		{{thing}}
	</ion-item>
</ion-list>
<ion-infinite-scroll
		on-infinite="next()">
</ion-infinite-scroll>

#2

I ended up setting $scope.next to undefined when an empty response is returned, and found this solution using ngIf, but without unsetting the onScroll handler I continued to see it being triggered after setting the ngIf variable to false: https://github.com/driftyco/ionic/issues/661