I am trying to add an additional header to an array of objects that contain the headers to my table.
My question is, how would I add a header, manually to the same object property 'name'?
I tried to initialize the array before push, but that does not give me the first element.
Example:
vm.headers = ["Products"];
angular.forEach(vm.metadata, function (value, key) {
//headers
vm.headers.push({
name: value.DataFieldTitle,
});
});
Many thanks.
UPDATE:
I was initializing the array incorrectly. I got it to work like:
vm.headers = [{Name: "Products"}];
And the rest of the code stay the same.
header? is a property?