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
Hello again :)
Is it possible to pass data from a MenuItem to an angularjs controller?
Example:
MenuItem mi = new MenuItem( "productcategories-edit","New product category" ); mi.Icon = "icon icon-add"; mi.AdditionalData.Add( "parent", "0" ); menu.Items.Add( mi );
How do I retrieve the "AdditionalData" in the angularjs controller?
Thanks. Kris.
Maybe I should explain what I want to accomplish :-)
I created an Umbraco 7 Custom Section with a menu tree.
When I rightclick a menu item I want to be able to add a new item.
Therefor I need to pass the id of the parent node to my angularjs controller, so I know to which parent node I need to add the new node.
Is this id available somewhere? (in $scope or $routeParams or somewhere else?)
Or do I need to pass it myself using the example above?
I can't find any documentation about this.
Thank you for any help.
After a long search I found my additional data (named "parent" in my example) in the dialogOptions :-D
var dialogOptions = $scope.dialogOptions; $scope.ProductCategoryPK = dialogOptions.currentAction.metaData.parent;
Is that the correct way to retrieve it?
Thanks. K.
Hi,
I am trying to do the exact same thing...
Here is my menu item
private void ContentTreeController_MenuRendering(TreeControllerBase sender, MenuRenderingEventArgs e) { var item = new MenuItem("exportCsv", "Export to CSV"); item.AdditionalData.Add("actionView", "/App_Plugins/exportCsv/index.html"); item.AdditionalData.Add("parent", "1234"); item.Icon = "save"; e.Menu.Items.Insert(e.Menu.Items.Count, item); }
Here is my html
<div class="umbracoDialog umb-dialog"> <p>Click <em>export</em> to download items to CSV</p> <script> var dialogOptions = $scope.dialogOptions; $scope.ProductCategoryPK = dialogOptions.currentAction.metaData.parent; alert(dialogOptions.currentAction.metaData.parent); </script> <div class="umb-dialog-footer btn-toolbar umb-btn-toolbar"> <a href="/Umbraco/Backoffice/Api/NewsItemExport/Export?nodeTypeAlias=jobClassificationIndustry" target="_blank" class="btn btn-primary"> Export </a> </div> </div>
How do I access the $scope.dialogOptions; as in your example. Is this through javascript or am I understanding something wrong?
Any assistance would be appreciated
I was working in javascript, indeed.
is working on a reply...
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.
Continue discussion
Passing data to angularjs controller from MenuItem
Hello again :)
Is it possible to pass data from a MenuItem to an angularjs controller?
Example:
How do I retrieve the "AdditionalData" in the angularjs controller?
Thanks. Kris.
Maybe I should explain what I want to accomplish :-)
I created an Umbraco 7 Custom Section with a menu tree.
When I rightclick a menu item I want to be able to add a new item.
Therefor I need to pass the id of the parent node to my angularjs controller, so I know to which parent node I need to add the new node.
Is this id available somewhere? (in $scope or $routeParams or somewhere else?)
Or do I need to pass it myself using the example above?
I can't find any documentation about this.
Thank you for any help.
After a long search I found my additional data (named "parent" in my example) in the dialogOptions :-D
Is that the correct way to retrieve it?
Thanks. K.
Hi,
I am trying to do the exact same thing...
Here is my menu item
Here is my html
How do I access the $scope.dialogOptions; as in your example. Is this through javascript or am I understanding something wrong?
Any assistance would be appreciated
I was working in javascript, indeed.
is working on a reply...
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.