Angularjs 角度引导模式下的ng绑定html

Angularjs 角度引导模式下的ng绑定html,angularjs,angular-bootstrap,Angularjs,Angular Bootstrap,我在模板中使用带有ng bind html指令的角度引导模式,但是正在绑定的html中的ng单击不起作用 $scope.shouldWork = function () { // stuff }; $scope.html1 = '<span ng-click="shouldWork()"></span>' var modal = $modal.open({ $scope, template: '<div ng-bind-html="html1">&

我在模板中使用带有ng bind html指令的角度引导模式,但是正在绑定的html中的ng单击不起作用

$scope.shouldWork = function () {
  // stuff
};
$scope.html1 = '<span ng-click="shouldWork()"></span>'
var modal = $modal.open({
  $scope,
  template: '<div ng-bind-html="html1"></div>'
});
$scope.shouldWork=函数(){
//东西
};
$scope.html1=“”
var modal=$modal.open({
$scope,
模板:“”
});

shouldWork()
永远不会被调用。还有其他方法可以让它工作吗?

修改html1变量后,您需要编译内容。您需要使用angular.element获得新内容的句柄,然后使用$compile将范围绑定到仍然不工作的新元素。我很确定这是ng bind html的某种安全特性,html正在编译中,但我认为它有意删除任何ng click指令。