AngularJs String SubStr: JavaScript SubStr Method is used to extract parts of string between two specified positions ie. start and end and it returns the string between the specified location. Here in this tutorial we are going to explain how you can use JavaScript substr() method to extract parts of a string. You can also use our online editor to edit and run the code online.
AngularJs String SubStr JavaScript Example
Let us create an example to understand how to use JavaScript substr function in AngularJs-
AngularJs String SubStr Method Example:
<div ng-app="myApp"> <div ng-controller="myController"> <button type="button" ng-click="substrExample()">Click Me</button> <p>Result = {{result}}</p> </div> </div> |
In the above example we have created an example which will extract sub part from the string. If you run the above example it will produce output something like this –