Tutorialsplane

AngularJs split string


AngularJs split string โ€“ There are many ways to split string . Here in this tutorial we are going to explain how you can use split() method to split the string in AngularJs. You can use our online demo try and edit the code online.


AngularJs split String to Array | Example

You can use split() method to split string into array. Here is full example โ€“

AngularJs split String to Array | Comma Separated string Example:



 
 

  
<div ng-app="myApp">  
<div ng-controller="myController">  
String[0] = {{exampleString.split(',')[0]}}<br/>
String[1] = {{exampleString.split(',')[1]}}<br/>
String[2] = {{exampleString.split(',')[2]}}<br/>

</div> 
</div>
  
  

Try it ยป

In the above example we have created a simple example to split the string in AngularJs.

If you run the above example it will produce the output something like this โ€“