I want to do an angular directive, which checks the height of an element, and if the height is given, I want to append another element to it. I'm new to Angular, so I dont know exactly how to do it. Here is a snippet of what I did so far:
the HTML:
<ul fadeouttxt>
<li ng-repeat="cars in cars.list" style="height:200px;">
<div>
<div class="cnt">
<h2>{{cars.title}}</h2>
<div class="desc" ng-bind-html="cars.description"></div>
</div>
</div>
</li>
</ul>
the js:
.directive('fadeouttxt', function () {
return {
link: function (scope) {
$('div.cnt').filter(function() {
if( $(this).find('.desc').height() < 130) return;
$(this).append('<div class="fader"></div>');
});
}
};
});
the <div class="fader"></div> is a element which makes the overflowing text fade out...
So, can anyone help me out?