我是AngularJS的初学者。我正尝试在“ng-show”的帮助下在过滤过程中显示“No Tag Found”。ng-show当数组长度为零时
JS:
function simpleController($scope)
{
$scope.tags = ['HTML','CSS','Jquery','Bootstrap','AngularJS'];
}
HTML:
<div ng-controller="simpleController">
<input class="txt" type="text" ng-model="nameText" />
<div>
<ul>
<li ng-repeat="myKeys in tags| filter:nameText">{{myKeys}}</li>
</ul>
<div ng-show="!tags.length">No Tag Found</div>
</div>
</div>
当我键入比阵列以外的任何值VALES,我没能获得 “否标签找到” 使用上述码。请帮忙。谢谢。
谢谢你的小提琴。这就是我正在寻找的:)干杯 – user2218497
你也可以使用'!count(tags)'[点击这里查看Cetia小提琴的修改版](http://jsfiddle.net/HB7LU/26922/) –