angular-masonry
angular-masonry copied to clipboard
Combined with angular-utils-pagination
For anyone else trying to do some pagination stuff, I had success by changing the pre function of the masonry directive to a post one. Just worked! Don't really understand why, but previously it would just end up ordering the items vertically.
Sorry, don't quite understand the context here. Is this a bug? :)
It is an 'incompatibility' issue, although I am not sure it was really intended for angular-masonry to work well with angular-utils pagination.
I wanted to have pagination for angular-masonry. My data come from an ajax request (service). I tried angualar-utils pagination but it didn't work.
To load the data I used the method described here: https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination#working-with-asynchronous-data
I am new to angular so I am not sure why, but it seemed to me that angular-masonry was doing its work too early, so it ended up rendering just a column, instead of a grid. The items were one below the other.
I found some instructions on how to override the directive without touching the file, so I did the following:
app.config(function($provide) { $provide.decorator('masonryDirective', function($delegate) { var directive = $delegate[0]; directive.link.post = directive.link.pre; delete(directive.link.pre); return $delegate; }); });
It worked, and now I have a paginated angular-masonry, so I wanted to share with anyone trying the same.
I can't believe but it worked perfectly!, hope no surprises comes up! :+1: