using postfilter for entityResource.getAll [angula...
# help-with-umbraco
u
Hi, can somebody shed some light on how to use "postFilter" option on entityResource.getAll()? The base of my issue is that I want to get the first content node with the alias "chain"
s
I don't have any experience with it but I found somewhere we use it in Umbraco, like so:
entityResource.getAll("Macro", ($scope.model.dialogData && $scope.model.dialogData.richTextEditor && $scope.model.dialogData.richTextEditor === true) ? "UseInEditor=true" : null)
So I'm guessing
$scope.model.alias === "chain"
could work (not sure what is in
$scope.model
though!)
u
Thanks, I’ll try it tomorrow 👍
I cant seem to make post filter make any difference Also, after reading your answer and the docs again i can see that the docs says that postFilter is supposed to be a string, but whatever i try and send its always the same result 🙂 But thanks for your suggestion
s
Yeah it looks like it's not actually using the properties on
$scope.model
but is rather sending in
UseInEditor=true
and I don't really know how you would know what to send in there! So I'm guessing it's not made for the purpose you need. You could instead do a
getAll
and then filter that one in a foreach. Not very performant but could work if you are working with a small amount of items. There might be better ways, but I'm not that familiar with the code!
u
That is the solution I went with, and to make it more performant I made it so it will only do the api call once per page load, and only if requested 🙂