Recently started working with Angular 1.5 and Typescript
I have a service that returns data in an array format called devices.headerEntries:
[{name:id,value:45} ,{name:Mode,value:1},{name:State,value:2},{name:serialnum,value:123434}
I created a component structured like this
module my.app {
'use strict';
export enum ModeEnum {
Unknown = 0,
Manual,
Scheduled
}
export enum StateEnum {
Unknown = 0,
Playing,
Paused,
Stopped
}
@mmw.core.Component('my.app', 'mmwListView', {
controllerAs: 'vm',
bindings: {
device: '<'
},
templateUrl: 'app/mydevice/mmw-listview.component.html'
})
class ListViewComponent {
static $inject = ['$window'];
constructor(private $window: ng.IWindowService
) {
}
public device: devices.headerEntries
}
The view looks like this
<md-content>
<md-list-item class="md-2-line" ng-repeat="hi in vm.device.headerEntries">
<div class="md-list-item-text">
<h3> {{hi.name}}</h3>
<p> {{hi.value}}</p>
</div>
</md-list-item>
</md-list>
I am struggling to display enum text values for properties like Mode, state on the UI. I need to show data like [Id, 45] [Mode, Unknown] [State, Paused] [Serial Number, 1333] on the UI