I am trying to implement instant search using filters in angular js. I want the "Not Found!!" message to be displayed when the filter is empty i.e. when no matching result is found. The ng-hide directive doesn't seem to work when filter array is empty.
<!DOCTYPE html>
<html ng-app="myApp">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body ng-controller="places as p">
<div>
<input type="text" ng-model="cname" />
<div ng-repeat="country in abc=(p.countries|filter:cname)">
<h1>{{country.name}}</h1>{{abc.length}}
<span ng-hide="abc.length">Not Found!!</span>
</div>
</div>
<script>
var app = angular.module('myApp', []);
var arr = [{
name: 'germany'
}, {
name: 'mexico'
}, {
name: 'india'
}, {
name: 'UK'
}, {
name: 'argentina'
}];
app.controller('places', function() {
this.countries = arr;
});
</script>
</body>
</html>