I have the following scenario:
<div class="parent" style="height:100%">
<div class="left" style="float:left" dynamic-height element-id="{{$index}}">
</div>
<div class="right" style="float:left">
<div>Element 1</div>
<div>Element 2</div>
</div>
</div>
I'm trying that the left element will be at the same height as the .right or the .parent, i tried to add directive for that, with not much success, anyone have a better idea?
the directive:
.directive('dynamicHeight', function() {
return {
compile: function compile(tElement, tAttrs, transclude) {
return {
post: function postLink(scope, elem, attrs) {
var element = "#discussion-element-"+ attrs.elementId;
var myEl = angular.element( document.querySelector( element) );
var height = myEl[0].offsetHeight;
element.height(height);
}
}
}
};
});
Image that illustrate the issue:
Try removing the float: left
style and applying these styles instead:
.parent {
display: table;
}
.parent > * {
display: table-cell;
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments