Closed josetaira closed 8 years ago
Probably easier to make context-menu="menuOptions"
allow...
$scope.menuOptions = function (name) {
var deferred = $q.defer();
setTimeout(function() {
deferred.resolve([
// resolved menu items.
]);
}, 1000);
return deferred.promise;
}
It already allows a function that returns an array so returning a promise would be easier to understand.
@Templarian yeah, seems logical. Any plans on implementing this any time soon?
I've implemented this and created a PR here: https://github.com/Templarian/ui.bootstrap.contextMenu/pull/52
My implementation is a bit different that only nested menus are supported as promises. The main menu must be your default menu structure.
Have a parameter you can specify that will be called to return the array that will be supplied to the nested menu before it is rendered. I'm thinking this can be simple function that returns the nested menu array which will be called before render menu of the nested arrays, or it can be an object, something like: {"nestedMenuLoader": function(){return []};}.
The object option might be better since from here any future new parameters can just be a new key in this object. Your thoughts?