Using AngularStrap. Invoking the $dropdown service from the controller does show the dropdown, but the click on the items does not invoke the respective code.
Plunk to demonstrate this.
http://plnkr.co/edit/tNAX7liFSNh71XcOUecs
var dropdown = $dropdown(element, {
show: false,
trigger: "manual",
html: true
});
dropdown.$scope.content = [
{
"text": "<i class=\"fa fa-globe\"></i> Display an alert",
"click": "alert(\"Holy guacamole!\")"
},
{
"divider": true
},
{
"text": "Separated link",
"href": "#separatedLink"
}
];
element.on("contextmenu", function(event) {
event.preventDefault();
console.log("dropdown right click");
scope.$apply(function() {
scope.dropdown_show = true;
});
});
The alert function you are trying to call should exist in the scope.
try to add below in your controller, just above where you set the content.
dropdown.$scope.alert = function(str){
alert(str)
};