Hello Readers, If your web page have multiple lists of words and you want to sort them in real time. Then by using Angular js you can do it.
Let's see how it will work.
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="namesCtrl">
<p>Filtering input:</p>
<p><input type="text" ng-model="test"></p>
<ul>
<li ng-repeat="x in names | filter:test | orderBy:'country'">
{{ (x.name | uppercase) + ', ' + x.country }}
</li>
</ul>
</div>
<script src="namesController.js"></script>
</body>
</html>
Now when you type inside the text box then only the matching country words will be remain on page while all other words will be hidden.
0 Comment(s)