Angularjs Examples

AJS Examples


AngularJS Extract Subset of Array Using Limitto Filter

In this AngularJS limitto filter example you will learn how to extract substring from string using limitto filter

Here you can view the output of the example and you can also "try it yourself" by clicking on "Live Demo" button given at the bottom.

Syntax

{{ string | limitTo : limit : begin}}

AngularJS Extract Subset of Array Using Limitto Filter Example

<!DOCTYPE html>            
<html>            
<head> <!-- www.techstrikers.com -->             
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
    <meta charset="utf-8">            
    <title>AngularJS Extract substring from string 
	using limitto filter</title>
  <script>            
var app = angular.module('app', []);            
    app.controller("ParentController", function ($scope) {    
      $scope.someString = "This is example for limitto filter";
      $scope.longNumber = 23432342;
      $scope.strLimit = 15;
      $scope.numLimit = 5;
    });     
</script>            
</head>            
<body style="background-color:#DDE4E9;">            
  <fieldset style="background-color:#DDE4E9;font-family:arial">                        
    <legend>AngulerJS Extract substring from string 
	using limitto filter Example</legend>     
  <div ng-app="app">     
    <div ng-controller="ParentController"> 
      <p>Sub string :<input type="number" ng-model="strLimit">  {{ someString | limitTo:strLimit}}</p>
      Digit Length : <input type="number" ng-model="numLimit"> {{ longNumber | limitTo:numLimit }}
      
  </div>    
</div>            
</div>            
 </fieldset>             
</body>            
</html>