Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul de Quant 403 posts 1520 karma points
    Apr 26, 2018 @ 09:25
    Paul de Quant
    0

    How to get an entity by UDI in angular controller

    Hello,

    Does anyone know how you get an entity by a UDI in an angular controller?

    I'm currently using this, but it only seems to work for the conventional integer Id.

                                entityResource.getByIds(ids, "Document").then(function (medias) {
    
                                _.each(medias, function (media, i) {
    
                                    //only show non-trashed items
                                    if (media.parentId >= -1) {
                                        $scope.images.push(media);
                                        $scope.ids.push(media.id);
                                    }
                                });
    
                                $scope.sync();
                            });
    

    I need to pass in a list of UDI's to get around a Courier issue.

    Thanks

    Paul

  • Bo Jacobsen 590 posts 2366 karma points
    Mar 06, 2019 @ 08:43
    Bo Jacobsen
    0

    Hi Paul.

    We had the exact same issue. Because Umbraco Cloud creates new id's on media files, when transfered.

    So all our custom grid editors, where we use the media picker, took the wrong images.

    But we found out that you also can get media by udi's.

    var udi1 = "umb://media/8bc1618636a744dda98bc29df4d7ae56";
    var udi2 = "umb://media/da98bc29df4d7ae568bc1618636a744d";
    
    entityResource.getByIds([udi1,udi2], "Media").then(function (medias)
    
Please Sign in or register to post replies

Write your reply to:

Draft