Here I would like explain that how to identify no records found in object or array of javascript with angularJS filters.

For that we have to find the length of search text in object if not found in object what we are trying to search.

Just we need to mention “Filter:searchText as Results“.

Here “Results” length helped to show the “no results found message”
ex: ng-if=”reults.length==0″ ->”no results found”

Here You can find complete example
<!doctype html>
<html lang=”en”>

<meta charset=”UTF-8″>
<title>AngularJS Filter with No Result Found Message if Resord is not in object</title>

<script src=”//”></script>
app= angular.module(“myApp”,[]);

$scope.students=[{“Name”:”Madhu Bheemagani”},{“Name”:”Raju Pasunoori”},{“Name”:”Krisha Rao”},{“Name”:”Chinna Rao”}]



<body ng-app=”myApp”>
<div ng-controller=”filterCtrl”>
<input ng-model=”searchT” type=”text”><br>
<ul><li ng-repeat=”student in students | filter:searchT as Result”>{{student.Name}}</li>
<li ng-if=”Result.length==0″>No Result Found</li></ul>

Please share you thoughts….
AngularJS Filter with No Result Found Message if Resord is not in object


  • No Result Found


5168 Total Views 7 Views Today

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>