diff --git a/README.md b/README.md
index 436a790..677042b 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ bower install iisg/cytoscape-actionbar --save
icon: 'fa fa-search-minus' # class for actionbar button
tooltip: 'Zoom out' # button tooltip message
action: (cy) -> # function to call
+ condition: $compile("")($scope) # optional compiled angular expression which wraps button
...
},
..
diff --git a/src/CytoscapeActionbar.coffee b/src/CytoscapeActionbar.coffee
index f132e72..eaec349 100644
--- a/src/CytoscapeActionbar.coffee
+++ b/src/CytoscapeActionbar.coffee
@@ -16,7 +16,13 @@
$.each(options.items, (itemIndex, element) ->
clazz = options.actionItemClass + ' icon ' + element.icon
$element = $("")
- $actionbar.append($element)
+
+ if element.condition
+ $condition = $(element.condition)
+ $actionbar.append($condition)
+ $($actionbar[0].lastChild).append($element)
+ else
+ $actionbar.append($element)
$element
.on('click', ->