In my custom section I am trying to get in AngularJS the active node when clicking straightforward on the three dots button - please note that I am not clicking on the name of the item:
var activeNode = appState.getTreeState("selectedNode");
However I get null as the item has not been actually selected (you can see it is not highlighted in blue color).
Is this a bug or is there any other way to get the selected node when clicking on the three dots button?
Can you post the 'outer' code to provide some context of where you are when trying to do this i.e an angular controller for the dashboard of the section / an edit view for a node or within a controller for the dialog panel.
If you are in the dialog you can do this.
var currentNode = $scope.dialogOptions.currentNode
angular.module("umbraco").controller("CatalogueDashboard.Controller",
function ($scope, eventsService) {
eventsService.on("treeOptionsClick", function (e, args) {
// this never gets fired
});
});
Get selected node when clicking (AngularJS)
Hi,
In my custom section I am trying to get in AngularJS the active node when clicking straightforward on the three dots button - please note that I am not clicking on the name of the item:
However I get
null
as the item has not been actually selected (you can see it is not highlighted in blue color).Is this a bug or is there any other way to get the selected node when clicking on the three dots button?
Thank you very much!
Can you post the 'outer' code to provide some context of where you are when trying to do this i.e an angular controller for the dashboard of the section / an edit view for a node or within a controller for the dialog panel.
If you are in the dialog you can do this.
In my version of umbraco there is also this, an event is triggered when clicking on the dots..
(inside umb-tree diretive)
Maybe in what ever controller you are using you could inject eventsService then..
Thanks Ian, in my version of Umbraco I can see the
emitEvent
in the umbraco.directives.js file (line 2910).However, when I inject the eventsService in my controller the
treeOptionsClick
event does not get fired...Some simplistic code:
The view:
The controller:
OK after some more digging treeOptionsClick does not get sent to the events service only from the tree directive to the tree controller.
However this should work for you
is working on a reply...