我如何在ng-bind-html中使用ng-click

时间:2014-09-18 06:29:48

标签: javascript html angularjs ng-bind-html

我在我的控制器中使用ng-bind-html,如

$scope.message='  You  currently have no ORDERS <a href= "javascript:void(0)" ng-click="Back()">Back13</a>';

和html页面

<strong ng-bind-html="message">Warning!</strong>

但是,即使我尝试将$ compile作为similar question ,Back()也无法正常工作。 任何人都可以解决这个问题吗?

1 个答案:

答案 0 :(得分:-1)

试试这个

$scope.message='  You  currently have no ORDERS <a **href="javascript:;"** ng-click="Back()">Back13</a>';

href="javascript:void(0)"更改为href="javascript:;"

并且还会看到以下讨论

ng-click do not work when a template bound using ng-bind-html-unsafe

AngularJS: ng-bind-html doesn't work with button tag

相关问题