I am trying to change the value of an expression based off an object of options
Currently I have an expression {{ resultItem.OdometerUnit }} which returns a total of 3 variations depending on result type
- hours
- kilometers
- miles
I want to first check whats returned to expression, and then convert the value to a shorthand version based off the below values
- hrs
- kms
- ms
I am thinking to do this using an object as follows:
$scope.odometerUnitsTranslate = [
{ name: 'Kilometers', trans:'Kms' },
{ name: 'Hours', trans:'Hrs' },
{ name: 'Miles', trans:'Ms' }
];
Beginner with angular so not sure best approach. Any help appreciated
Thanks
{{ resultItem.OdometerUnit | units }}.