Templarian / ui.bootstrap.contextMenu

AngularJS Bootstrap UI Context Menu
MIT License
259 stars 127 forks source link

Support promises for menu options #24

Closed moravcik closed 8 years ago

moravcik commented 9 years ago

You may hook the item function result with $q.when() which will handle plain results or promises in same way, e.g.

$q.when(item).then(function(itemResult) {
  // use itemResult here 
})

To wait for all promises you may use also $q.all()

I need to translate the item text for context menu, and $translate('key') returns a promise by default, but it might be a case for other use cases as well.

Templarian commented 8 years ago

This was merged. If you get v0.9.5 you'll see this functionality.