From the back-end, I am getting a string as construction,apply
- that means 2 words together.
Now I need to break them into 2 words and I need to use the ng-repeat
. I created a filter
to do that. It splits the string into an array with a length of 2, but how to use this in ng-repeat
?
Here is my code :
<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>
my filter:
angular.module("tcpApp")
.filter("commaBreak",
function () {
return function (value) {
if (!value.length) return;
return value.split(',');
}
});
What am I doing wrong here?