【发布时间】:2017-08-09 08:53:51
【问题描述】:
我尝试使用 ng-bind-html 添加一些代码,并包含 ng-mouseover。但是ng-mouseover 部分没有出现(不起作用)在代码中
来自 angular plunker 的示例并添加我的一段代码:
ng-mouseover="test($event)"
(function(angular) {
'use strict';
angular.module('bindHtmlExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.myHTML =
'I am an <code>HTML</code>string with ' +
'<a ng-mouseover="test($event)" href="#">links!</a> and other <em>stuff</em>';
$scope.test = function(event) {
console.log(event);
}
}]);
})(window.angular);
https://plnkr.co/edit/gp3Z50TJqvEfOFGrpYCT?p=preview
$scope.test() 函数从未被触发。鼠标悬停在这个小链接上方没有出现任何事件。
有什么提示吗?
【问题讨论】: