Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to sort the real time data from a text box using Angular JS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 338
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: