Skip to content

Instantly share code, notes, and snippets.

@loujaybee
Created November 9, 2015 17:43
Show Gist options
  • Save loujaybee/2e72b6f666fef94c9264 to your computer and use it in GitHub Desktop.
Save loujaybee/2e72b6f666fef94c9264 to your computer and use it in GitHub Desktop.
Angular watch and unwatch
// Wait for the value to be populated, initialise and then close
var setupWatch = scope.$watch('collectionToPopulate', function(){
if(!_.isEmpty(scope.collectionToPopulate)){
infinite_scroll.loadInitialElements();
infinite_scroll.setupInfiniteScrollToRunOnDelay();
setupWatch();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment