Copied to clipboard

Flag this post as spam?

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


  • Simon 24 posts 127 karma points
    Oct 27, 2016 @ 14:34
    Simon
    1

    $scope.model.config is always null

    I'm trying to create a dropdown property for macros. I have managed to do this however I can't seem to access the config values to populate it. I was hoping to have a list of values in $scope.model.config.testValue1

    angular.module("umbraco").controller("My.MacroDropDownController",
    function ($scope) {
    
        if ($scope.model.config == null) {
            alert('still null!');
        }
        else {
            alert('HAS A VALUE!');
        }
    
    });
    

    Here is my manifest:

    {
    // you can define multiple editors
    propertyEditors: [
        {
            alias: "My.MacroDropDown",
            name: "My macro dropdownr",
            icon: "icon-code",
            group: "Rich Content",
    
        isParameterEditor: true,
    
            editor: {
                view: "~/App_Plugins/MacroDropDown/macrodropdown.html"
            },
    
            prevalues: {
                fields: [
                    {
                        label: "Test value 1",
                        description: "desc goes here",
                        key: "testValue1",
                        view: "multivalues"
                    }
                ]
            }
        }
    ]
    ,
    javascript: [
        '~/App_Plugins/MacroDropDown/macrodropdown.controller.js'
    ]
    

    }

    I've added them in the Data Types section and can see it in the database.

    Any ideas why $scope.model.config is always null?

  • Marc Goodson 2157 posts 14434 karma points MVP 9x c-trib
    Oct 28, 2016 @ 00:41
    Marc Goodson
    100

    Hi Simon

    You can use a custom 'property editor' for a 'Data Type' or for a 'Macro Parameter', but you can't use a Data Type for a Macro Parameter, if that makes sense ?

    I mean it would make sense if you could...

    but at the moment, there is no UI to provide the prevalues when the property editor is used as a Macro Parameter, which is why scope.config is always null.

    In the past I've hardcoded the prevalues inside the 'property editor' :-( I guess you could maybe have them in your own config file, read into the editor...

    regards

    Marc

  • Simon 24 posts 127 karma points
    Oct 28, 2016 @ 07:14
    Simon
    0

    Thanks Marc, I had a bad feeling it was going to be something like that.

    As you say I'll probably add the values to a config file then load them based on an alias suffix.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies