From the back-end, I am getting a string as
construction,apply
ng-repeat
filter
ng-repeat
<div class="column design">
//app.Phase here is : `construction,apply`
<span ng-repeat="value in activeApp.Phase || commaBreak">{{$index}}</span> //instead of index i would like to show the word.
</div>
angular.module("tcpApp")
.filter("commaBreak",
function () {
return function (value) {
if (!value.length) return;
return value.split(',');
}
});
Here it is:
var myApp = angular.module('myApp',[]);
myApp.controller('MyCtrl', ['$scope', function($scope) {
$scope.name = "construction,apply";
}]);
myApp.filter("commaBreak",
function () {
return function ( value ) {
if( !value.length ) return;
return value.split(',');
}
});
On html part you need to use the single OR.
<div ng-controller="MyCtrl">
<p ng-repeat="value in name | commaBreak">{{value}}</p>
</div>
Here is the working example: http://jsfiddle.net/HB7LU/16459/