I have created a custom Umbraco 7 dashboard. In it I want to get specific field details from instances of a known type of document type in my Umbraco CMS.
I have successfully obtained a list of all documents of a specific type by using entityResource.getChildren(1386, "Document")
, and subsequently call entityResource.getById(item.id, "Document")
on each such document. I can see many details for each document instance, but not the data the editor entered when creating it. How do I get this information using the Angular services/API of Umbraco?
Sample of dashboard code:
// get community alerts
entityResource.getChildren(1386, "Document")
.then(function (ent)
{
angular.forEach(ent, function (item)
{
let communityalert = {
umbracoItem: item,
title: '', // I want data from each document to put here
topic: ''
};
entityResource
.getById(item.id, "Document")
.then(function (entity)
{
console.log('entity', entity);
communityalert.title = entity.name;
communityalert.umbracoItem = entity;
entityResource
.getUrl(item.id, "Document")
.then(function (url)
{
communityalert.url = url;
// finally push collected data to VM.
vm.CommunityAlerts.push(communityalert);
});
});
});
});