Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
What is the right way to intercept save event in the backoffice with AngularJS.
We have to extend save button functionality and add some callback to start saving event and to saved even, is it possible?
I, unfortunately, don't have an answer for this but this is something I will need to be able to do myself in the not too distant future.....so I figured I would post so others could see the "demand" for this knowledge, haha.
Hi Alex and ThisIsMeJKB.
You do this by creating a custom ApplicationEventHandler class.
Here is an example of how to do this:
public class MyApplicationEvents : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
ContentService.Saving += ContentService_Saving; // rasied before the content has been saved.
ContentService.Saved += ContentService_Saving; // raised after the content has been saved.
/// Event raised when content is saved/saving.
/// <param name="contentService">Can be used for creating/deleting/editing/move other content etc.</param>
/// <param name="eventArgs">Can be used for showing custom notifications, canceling the save event, and accessing the content beeing saved etc.</param>
private void ContentService_Saving(IContentService contentService, SaveEventArgs<IContent> eventArgs)
/* Do custom wizard stuff here.. */
Hope this was useful.
NOTE: You probobly wont have the same method for both the ContentService.Saving and ContentService.Saved event, cuz that would case the same method to be rasied twice every time you save a piece of content. You probobly have two different methods for each event or you might only be needing the Saving or Saved event.
I just wrote like this in my example so that you would see that its possible to hook in before and after the content saves.
Thank you very much for your reply, but I wanted more to use it in angular if possible, maybe I had to explaine better, but thanks again for youur answer.
Matt Brailsford wrote about this on last years 24 days in Umbraco calendar.
Especially the part about tweaking logic is what you are after.
Ah, im sorry.
Did´nt see any Angular mentions in your original post. :/
Maybe someone else will be happy for the code example.
Have a great weekend Alex!
Your original response is exactly what I was looking for you.
Very big thank you to Dennis and Dave, you solved 2 topics!!!
Dave your link is exactly what I need.
Have a great weekend!
Great! Glad to help!! :)
The ApplicationEventHandler approach no longer works in Umbraco 8. Instead, you'll need to use composition.
The Umbraco documentation provides an example of how to listen to ContentService.Saving events.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted