Tutorialsplane

AngularJs String Slice JavaScript


AngularJs String Slice: Slice Method is used to extract parts of string. We can use JavaScript slice() method to extract parts of string. Here in this tutorial we are going to explain how you can use JavaScript slice() method to extract parts of a string. You can also use our online editor to edit and run the code online.


AngularJs String Slice JavaScript Example

We can use JavaScript Slice() method to extract a part of string. Let us create an example to understand this in AngularJs-

AngularJs String Slice Method Example:




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController"> 
<button type="button" ng-click="sliceExample()">Click Me</button>
<p>Result = {{result}}</p>
</div> 
</div>
  
  

Try it »

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 –