An array of images with varying heights but constant width needs to be displayed in a tightly streamlined manner on the page.
Using jQuery, we have 3 columns. The first step involves loading the images and then, after the onLoad event, moving the image to the shortest column.
However, working with angularJs presents challenges as cutting and rearranging items isn't as straightforward with angularJs.
One solution that has been devised is to store an array for each column and an array containing all the images. Each time an image is loaded, an event is sent to the controller which then selects the shortest column and places the image in its array. But I am facing difficulties implementing this in angularJs
<div class="container" ng-controller="columnCtrl">
<div class="column" ng-column="column1">
<div ng-repeat="imageSrc in columns.column1.imagesSrc">
<img ng-load="$emit('loadImg')"
src="{{imageSrc}}" alt="img" />
</div>
</div>
<div class="column" ng-column="column2">
<div ng-repeat="imageSrc in columns.column2.imagesSrc">
<img ng-load="$emit('loadImg')"
src="{{imageSrc}}" alt="img" />
</div>
</div>
</div>
Check out this Pluker example for a full demonstration of how this problem can be solved.