Copied to clipboard

Flag this post as spam?

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


  • Chris Houston 534 posts 979 karma points MVP admin c-trib
    Apr 15, 2016 @ 13:36
    Chris Houston
    0

    Passing parameters to AngularJS when opening a view using the MenuItem LaunchDialogView

    Hi All,

    I am using a custom Tree in the Umbraco back office and one of my right click context MenuItem items should use the LaunchDialogView method to display a dialogs.

    The following code seems to render the dialog view, but I can't seem to access the parameter being passed in the URL. I am also not sure if this is the "right" way pass data from the tree controller to the dialog?

    MenuItem.LaunchDialogView(string.Format("{0}?id={1}", urlHelper.Content("~/App_Plugins/MyApp/backoffice/MyTree/approveAll.html"), id), "Approve All");
    

    Best regards,

    Chris

  • Chris Houston 534 posts 979 karma points MVP admin c-trib
    Apr 15, 2016 @ 15:05
    Chris Houston
    4

    Thanks to Ben Howarth for pointing me in the right direction via a Skype chat.

    For anyone else who wants to know the answer, you need to use the following:

    In the TreeController:

    MenuItem.AdditionalData.Add("countryId",id);
    MenuItem.AdditionalData.Add("countryName", "France");
    

    And in the view AngularJS controller:

    var dialogOptions = $scope.dialogOptions;
    var metaData = dialogOptions.currentAction.metaData;
    $scope.countryId = metaData.countryId;
    $scope.countryName = metaData.countryName;
    

    Cheers,

    Chris

Please Sign in or register to post replies

Write your reply to:

Draft