如果长度(描述(
如果[[ demandAd.description ]]少于一行或少于一行(或长度<100(,我需要隐藏标签,因为它当时没有功能
<div class="demand">
<p class="demand-ad-time">[[demandAd.createdAt | date:"dd.MM.yyyy."]]</p>
<input type="checkbox" class="read-more-state" id="demandAd[[ demandAd.id ]]" />
<p>[[ demandAd.description ]]</p>
<label for="demandAd[[ demandAd.id ]]" class="read-more-trigger"></label>
<hr>
<div class="demand-chips">
<div class="demand-chip" ng-repeat="demandAdLabel in demandAd.labelsWithPlaces track by $index">[[ demandAdLabel ]]</div>
</div>
希望我理解正确,您希望在文本长度短于 100 时隐藏标签。您可以在ng-hide
内比较文本长度
<body ng-app="">
Hide base on text length: <input type="text" ng-model="myVar">
<div ng-hide="myVar.length >= 3">
<label>Hide when length >= than 3</label>
</div>
</body>
下面是一个实时示例代码:
https://plnkr.co/edit/vHVXyNCTzPiuVwq2fyOG?p=preview