Seems that the current website is asp.net web forms calling web api, I am converted to Angular calling Web api. The thing I am noticing is that I need to scrub the data.
How should I go about doing this?
Conditionals in the Html ?
example of old website output
Device Status Staged Archived
-----------------------------------------
Unactivated None 002,003,001
New Device None None
MY Angular /html output
Device Status Staged Archived
-----------------------------------------
3 null [002,003,001]
1 null []
- I need to convert the numbers to meaningful Device Status
- Seems I need to ALWAYS get rid of []
I thought about in Javascript ... as that is probably better than doing it in Html with angular
Thoughts?
How to do it either way , best practice?
Sample Data
{
"Devices": [
{
"DeviceId": "00022B9A000000010001",
"StagedManifestIdList": [],
"PendingManifestId": null,
"PendingTimeStamp": "0001-01-01T00:00:00",
"ManifestIdList": [
"00000002",
"00000001",
"00000003"
],
"DeviceStatus": 3,
"Aid": "oAAABTUAAg==",
"DKiIndex": "DKi00000002",
"Sha": "R2tiZRQgY/iohXZt5O4HaQwtVe/adWU2VOcKaelJ3Us=",
"DefaultPayload": "C:\\ProgramData\\\\Payloads\\M4PayloadAuto.xml"
},
........
]
}
Data $http call
Where does let statement go?
let result.statuses = ['Old Device', 'New Device', 'Activated', 'Unactivated'];
function DeviceController($http, $scope){
var vm = this;
var dataService = $http;
//dataService.get("/api/Product")
vm.devices = [];
deviceList();
function deviceList() {
$http.get(_url)
.then(function (result) {
vm.devices = result.data.Devices;
},
function(error) {
console.log('error');
});