Copied to clipboard

Flag this post as spam?

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


  • Steve Morgan 1348 posts 4457 karma points c-trib
    Aug 01, 2016 @ 11:28
    Steve Morgan
    0

    Custom Property Editor with Archetype - fails silently

    Has anyone had any issues creating custom property editors for use with Archetype?

    I've found that I need to hook on the alias of the element created - this was my first breakthrough (and I then found it was in the documentation!) and works for multiple instances of the editor on a doc type... next I came to test using it in Archetype.

    After a lot of swearing I found that if I add a timeout delay in the controller of the CPE the editor works as expected - without it the first instance in the archetype works but the subsequent ones don't. It seems to be an issue in that the hook onto the input field fails silently (like it hasn't yet been created in the DOM before the call to the controller takes place).

    angular.module("umbraco")
    .controller("My.FileUploader",
     function ($scope, assetsService) {
         // this hack adds a delay to allow archetype to create the elements or the hook onto the fileupload field seems to fail silently?
         setTimeout(function() {
             assetsService
            .load([
                // load js assets
            ])
            .then(function () {
                $('#' + $scope.model.alias + '-fileupload').fileupload({
                    ...  code to fire up fileupload
                    },
                });
            });
         }, 100);
     });
    

    Am I doing something silly in my controller?

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Aug 03, 2016 @ 09:38
Please Sign in or register to post replies

Write your reply to:

Draft