Is there an angular resource of some sort inside the api that can get prevalues from PropertyTypes?
I noticed the umbraco api has an angular filter called ncNodeName (in umbraco.filters.js). it takes a nodeId and returns the name of the node.
Awesome stuff & easy to use. especially with nested content. Now I want to do the same thing with propertyTypes, only to display the selected prevalue. The related filter does not exist as far as I now, so I attempted to construct it myself. The filter is based on the ncNodeNameFilter. I got the following result:
// Filter to take a propertytype id and grab it's prevalues instead
// Usage: {{ propertyTypeAlias | ncResolveId: aliasName }}
// Cache for node names so we don't make a ton of requests
var ncPropertyTypeCache = {
prevalues: {}
}
angular.module("umbraco.filters").filter("ncPropertyType", function (dataTypeResource) {
return function (input, alias) {
// Check we have a value at all
if (input === '' || input.toString() === '0') {
return '';
}
// See if there is a value in the cache and use that
if (ncPropertyTypeCache.prevalues[input]) {
return ncPropertyTypeCache.prevalues[input];
}
// No value, so go fetch one
// We'll put a temp value in the cache though so we don't
// make a load of requests while we wait for a response
ncPropertyTypeCache.keys[input] = 'Loading...';
dataTypeResource.getPreValues(alias, null).then(function (prevalues) {
console.log(prevalues);
ncPropertyTypeCache.prevalue[input] = prevalues;
});
// Return the current value for now
return ncPropertyTypeCache.prevalues[input];
};
});
The issue here is that dataTypeResource does not return the propertytype. I can only pass things over like 'umbraco.dropdown.flexible', not the ones I created. The returned values are kinda useless. I need to go a level deeper, but at first glance there is no resource available? Am I overlooking something?
Problem with finding PropertyTypes in api, replacing id's with prevalue names -angularjs filter
Hi all
Is there an angular resource of some sort inside the api that can get prevalues from PropertyTypes?
I noticed the umbraco api has an angular filter called ncNodeName (in umbraco.filters.js). it takes a nodeId and returns the name of the node.
Awesome stuff & easy to use. especially with nested content. Now I want to do the same thing with propertyTypes, only to display the selected prevalue. The related filter does not exist as far as I now, so I attempted to construct it myself. The filter is based on the ncNodeNameFilter. I got the following result:
The issue here is that dataTypeResource does not return the propertytype. I can only pass things over like 'umbraco.dropdown.flexible', not the ones I created. The returned values are kinda useless. I need to go a level deeper, but at first glance there is no resource available? Am I overlooking something?
Thanks in advance
Bert
is working on a reply...