How to do a List filtering in Angular JS?

By | August 20, 2017

Filtering is really easy in Angular JS.

In Angular JS we use the “filter” keyword to do the filtering.


<!DOCTYPE html>
<script src=""></script>

<div ng-app="myApp" ng-controller="namesCtrl">


<p><input type="text" ng-model="my_search"></p>

  <li ng-repeat="name in names | filter:my_search">
    {{ name }}


angular.module('myApp', []).controller('namesCtrl', function($scope) {
    $scope.names = [

<p>The list will only consists of names matching the filter.</p>


Copy and paste the above code in an html and run. You will see the result.

Here we have a variable named “my_search” which is a textbox in HTML. so the filter value is taken from the textbox.
You can see the ng-model=”my_search” set in the textbox.

Leave a Reply

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