Copied to clipboard

Flag this post as spam?

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


  • Jonathan Roberts 372 posts 1005 karma points
    Aug 10, 2017 @ 09:17
    Jonathan Roberts
    0

    AngularJS populate CMS page property

    Hi,

    Im a little new to AngularJs but I would like AngularJs to populate a CMS page property and then when I click on Save it appear in the PublishedEntities Properties.

    I can populate the Textbox property using AngularJs like this:

     angular.element(document.getElementById('facebookAccessToken')).val(response.authResponse.accessToken);
    

    BUT when I get as far as the ApplicationEventHandler:

    Umbraco.Core.Services.ContentService.Publishing += ContentService_Publishing;
    
    string fbAccessToken = e.PublishedEntities.First().Properties.Where(x => x.Alias == "facebookAccessToken").FirstOrDefault().Value.ToString() ?? "";
    

    fbAccessToken is NULL.

    If I touch the textbox and add a space at the end of the textbox and then click save the value has been entered into fbAccessToken, but I dont want the user to have to do this so I have tried a mixture of FocusOn FocusOut, triggering keypresses etc but alas none of these work.

    Does anyone know how I can populate a Textbox property in the CMS using Jquery/angularJS and for it to appear in the PublishedEntities Properties as expected?

    Thanks

    Jon

  • 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