You can add a filter to the status
that maps values that mean the same thing into the same value.
.filter('meaning', function() {
return function(input) {
input = input || '';
if (['wrong', 'amiss','awry', 'bad', 'erroneous', 'false', 'inaccurate',\
'misguided', 'mistaken', 'unsound', 'incorrect'].indexOf(input) != -1)
return 'wrong';
// You can make it generic like this:
synonymsDictionary = {
'someWord' : ['syn1', 'syn2', 'syn3' ... ],
'someOtherWord' : ['otherWordSyn1', 'otherWordSyn2', 'otherWordSyn3' ...]
.
.
.
};
for (var word in synonymsDictionary)
if (synonymsDictionary[word].indexOf(input) != -1)
return word; // This way you could iterate over a bunch of arrays...
// Edge case
else return input;
};
})
Then you simply
<p ng-switch="status|meaning">
<span ng-switch-when="wrong">
Wrong
</span>
<span ng-switch-default>
Correct
</span>
</p>
Although in your case, you may have just wanted to print a message so you could have pulled the message from a dictionary...
Something like:
<span ng-if="status">
{{getStatusMessage(status)}}
</span>