0

I am using an angular bootstrap modal with an ng-bind-html directive in the template but the ng-clicks in the html that is being binded do not work.

$scope.shouldWork = function () {
  // stuff
};
$scope.html1 = '<span ng-click="shouldWork()"></span>'
var modal = $modal.open({
  $scope,
  template: '<div ng-bind-html="html1"></div>'
});

shouldWork() never gets called. Is there anyway to get this to work?

user1809913
  • 1,785
  • 1
  • 14
  • 25
  • you need to compile the content after modifying the html1 variable you need to get a handle on the new content using angular.element and then use $compile to bind the scope to the new elements – Dayan Moreno Leon Jan 21 '15 at 01:30
  • That still doesn't work. I'm pretty sure this is some kind of security feature with ng-bind-html the html is being compiled but I think it purposefully removes any ng-click directives. – user1809913 Jan 21 '15 at 16:49

0 Answers0