Skip to content

Instantly share code, notes, and snippets.

@rajaraodv
Created November 25, 2012 05:43
Show Gist options
  • Save rajaraodv/4142528 to your computer and use it in GitHub Desktop.
Save rajaraodv/4142528 to your computer and use it in GitHub Desktop.
foobar directive with solution
//Wrap masonry with ImagesLoaded and wrap that again with a $timeout w/ a small delay solves the issue.
clientAppModule.directive('addMasonry', function($timeout) {
return {
restrict: 'A',
link: function(scope, element) {
$timeout(function(val) { //looks like timeout or deferred solves the issue
scope.container.imagesLoaded(function() {
scope.container.masonry('reload');
});
}, 0);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment