My webpage currently displays a grid that is not properly arranged. However, when I executed the code below in the console, the grid was formatted correctly:
var maxHeight = Math.max.apply(null, $("#activityfeeddetails").find(".course_thumb_outer").map(function (){
return $(this).height();
}).get());
$("#activityfeeddetails").find(".course_thumb_outer").css("height",maxHeight);
After executing the code, the screen now looks like this:
Question: How can I integrate this code into an Angular directive so that it runs once all the data and templates are loaded?
Here is the current directive that I have, but it's not working properly:
dwmProfileDirectives.directive('profileActivityFeedTab', ['Activityfeed', function(Activityfeed) {
return {
restrict: 'E',
scope: {
current:'=current'
},
templateUrl:'tabs/dwm-profile-activity-feed.html',
controller: function($scope) {
$scope.Activityfeeds = Activityfeed.get();
$scope.Activityfeeds.$get().then(function(v){
var maxHeight = Math.max.apply(null, angular.element("#activityfeeddetails").find(".course_thumb_outer").map(function (){
return $(this).height();
}).get());
angular.element("#activityfeeddetails").find(".course_thumb_outer").css("height",maxHeight);
});
}
};
}]);