Copied to clipboard

Flag this post as spam?

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


  • Ayo Adesina 430 posts 1023 karma points
    Sep 08, 2017 @ 09:50
    Ayo Adesina
    0

    Reusing Umbraco Property Editors - Two Way Binding Problems

    I really thought I had made significant progress in understanding how to reuse Umbraco Property Editors in my custom section, but I think I am still missing something fundamental.

    In my custom Angular views when I want to re-use an existing property editor I use the following code in my HTML file.

                        <umb-property property="startDateTimePropertyEditor">
                            <umb-editor model="startDateTimePropertyEditor"></umb-editor>
                        </umb-property>
    

    then I am setting the property and Model attributes to an object that I create in my controller, for this example:

    {
                    editor: "Umbraco.DateTime",
                    label: label,
                    description: description,
                    hideLabel: false,
                    view: "datepicker",
                    alias: alias,
                    value: null,
                    validation: {
                        mandatory: true,
                        pattern: ""
                    },
                    config: {
                        format: "YYYY-MM-DD HH:mm:ss",
                        pickDate: true,
                        pickTime: true,
                        useSeconds: false
                    }
                };
    

    I'm setting ‘value' in my controller and when the page loads the value is correctly displayed.

    The problem is when the value is changed in the UI it is not updated.

    Does anyone know how I can solve this? Is my approach to reusing the existing property editors correct?

    I have read so much, had a look at so many examples, but still finding it hard to bring the UI under my control...........

    Any pointers will be MUCH appreciated!

  • Ayo Adesina 430 posts 1023 karma points
    Sep 08, 2017 @ 12:26
    Ayo Adesina
    100

    I worked it out! -

    When the page loads, I read the correct values in to the property editors, but when I save the page I was trying to read the values from the enitity. The problem was the logic in my save method.

    Silly me!

Please Sign in or register to post replies

Write your reply to:

Draft