Copied to clipboard

Flag this post as spam?

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


  • Niclas Schumacher 67 posts 87 karma points
    Feb 05, 2014 @ 14:24
    Niclas Schumacher
    0

    backoffice save angular event?

    Hello guys!

    im creating a property editor, where i relate a member with a content. Ive gotten all the members out in a selectlist and im able to save one or more members to model.value. 

    Though, my problem is that i need to have this information in my own database table, where the members are associated to the content, but does the backoffice broadcast some kind of event so in my angular-controller i can catch that and save my information ? Or should i hook up to the afterSave event or something in c# ? 

    I would like to keep everything in angular / webAPI. 

    best regards Niclas

  • Olof Landahl 3 posts 24 karma points
    Oct 03, 2014 @ 09:54
    Olof Landahl
    0

    I have the same question.

    Have you found any answer to this?

     

    Cheers,

    /Olof

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Oct 03, 2014 @ 10:10
    Dave Woestenborghs
    0

    There are 2 approaches on how to do this.

    One you mentioned your self is to implement a save event.

    The other one requires you to rewrite your property editor. To use a c# class which inherits from a PropertyEditorBase class. Tim has a example of that on his blog : http://www.nibble.be/?p=415

    After that you need to implement a class inherting from PropertyValueEditorWrapper. This will allow you to handle how data is saved in the database for a property editor.

    You can see an example in from the core datepicker here : https://github.com/umbraco/Umbraco-CMS/blob/eae00873073f20c60e355ec6e95ff6259ad2652b/src/Umbraco.Web/PropertyEditors/DatePropertyEditor.cs

    But I would recommend the event.

    Dave

  • Alex Perotti 53 posts 94 karma points
    Apr 03, 2015 @ 12:45
    Alex Perotti
    0

    Hi, can you give some directions about how to implement a save event?

    thank you

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 03, 2015 @ 12:48
  • Alex Perotti 53 posts 94 karma points
    Apr 03, 2015 @ 12:56
    Alex Perotti
    0

    Hi Dave,

    I think I misunderstood your answer. I know how to implement a server side save event; I was wondering how to bind a custom function on angular js

    Actually I can catch the form submit

    $scope.$on("formSubmitting", function (e, params) { console.log(e); console.log(params); });
    

    and I have a resource and a webApi ready; my problem is that I can't distinguish between save, save and publish, unpublish and send to publish actions.

  • Sven Geusens 169 posts 881 karma points c-trib
    Mar 02, 2017 @ 10:58
    Sven Geusens
    3

    In case somebody else comes upon this, this is a way to check if the item is being published and or saved (and a fallback if you want it)

    $scope.$on("formSubmitting", function (ev, args) {
            if (args.action === "save") {
                alert("content is being saved.");
            } else if (args.action === "publish") {
                alert("content is being saved and published");
            } else {
                alert(args.action);
            }
        });
    
  • Alex Perotti 53 posts 94 karma points
    Apr 03, 2015 @ 13:00
    Alex Perotti
    0

    On the other hand, if I use the c# save event, I don't know how to get the property:

    in general, I don't know the name of property (and I don't want to force the user to compile a config file) and the propertyTypeEditor is a private field that I can't catch from code.

Please Sign in or register to post replies

Write your reply to:

Draft