It appears that the current website utilizes asp.net web forms calling web api, but I am looking to convert it to Angular calling Web api. One thing I have noticed is that I need to clean up the data.
How should I approach this?
Should I use conditionals in the Html?
Here is an example of the old website output:
Device Status Staged Archived
-----------------------------------------
Unactivated None 002,003,001
New Device None None
This is how my Angular/html output looks like:
Device Status Staged Archived
-----------------------------------------
3 null [002,003,001]
1 null []
- I need to assign meaningful Device Status to the numbers
- It seems like I always need to remove [] from the data
I am thinking about handling this in Javascript... as it might be better than doing it in Html with angular.
Any thoughts on this?
What would be the best practice for accomplishing this task, regardless of whether it's done in Javascript or Html?
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');
});