AngularJS: Split strings using angular expressions in angularJS

Standard

Angular Controller: 

angular
 .module('app', [])
 .controller('appController', function($scope) {
     $scope.temp = "green,blue,red,yellow"; 
 })

HTML View: 

<span ng-app="app" ng-controller="appController">
  {{temp.split(',')[0]}} 
  </br>
  {{temp.split(',')[1]}}
</span>
Advertisements