I need help selecting the parent element (searchres) in Angular and applying styles to it. Here is my HTML code:
<div ng-repeat="product in products" class="searchres">
<a href="#">
<img src="{{product.path}}" class="img-thumbnail" alt="{{product.name)}}" />
{{product.name}}
</a>
</div>
Here is the JavaScript code I have tried:
$.each($scope.products, function(index, value) {
var namePro = value.name;
if (namePro.length <= 32) {
$("body").find(".searchres").css("line-height","50px!important");// does not work
value.parentNode.css("line-height","50px!important"); // also does not work
}
});
Can anyone suggest a solution to this issue?