D
D
DizzyJager2014-05-30 13:55:42
Angular
DizzyJager, 2014-05-30 13:55:42

How to create a dynamic context menu in angularjs?

There is a drag'n'drop directive that calls a callback at the end, passing two parameters there: the transfer object and the object where it was transferred:

$scope.onDrop({ source: draggingElement, target: dropElement });

The task is to create a context menu with possible actions on the transferred element at the end of the transfer. The set of actions depends on the element type (Type property).
The problem is that only the directive and the callback function in the controller know about the transfer elements. In this case, menu items must perform some action on these elements. Storing them in the controller looks like a somewhat clumsy solution, generating them in a callback is also so-so.
+ it is not clear how to organize the structure of the menu itself.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question