JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.angularjs.org/1.2.16/angular.js"></script>
<div ng-app='myApp' ng-controller="ArrayController">
<br></br>
SELECT:
<select>
<option ng-repeat="(key, value) in headers">{{value | space}}
</option>
</select>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('ArrayController', function ($scope) {
$scope.headers = [{
value: 'value 1'
}, {
value: 'value 2',
mainId: 12
}, {
value: 'value 3'
}, {
value: 'value 4',
mainId: 14
}, {
value: 'value 5'
}, {
value: 'value 6',
mainId: 18
}];
});
app.filter('space', function() {
return function(text) {
if(_.isUndefined(text.mainId))
{
console.log('entered mainId');
return text.value;
}
else
{
console.log('entered');
return '\u00A0\u00A0' + text.value;
}
};
});