我想选择父角色(searchres)并获得样式,但我无法做到! 我的HTML是这样的:以角度选择父元素
<div ng-repeat="product in products" class="searchres">
<a href="#">
<img src="{{product.path}}" class="img-thumbnail" alt="{{product.name)}}" />
{{product.name}}
</a>
</div>
而且我的代码是这样的:
$.each($scope.products, function(index, value) {
var namePro = value.name;
if (namePro.length <= 32) {
$("body").find(".searchres").css("line-height","50px!important");// is wrong !
value.parentNode.css("line-height","50px!important"); // is wrong !
}
});
我应该为这个问题呢?
你想要什么,为什么不使用NG式 –
我用NG-风格:NG-风格=“product.name.length <= 32 { '的line-height':“50像素!重要的'}:{}“。但它不适合我! –