Files
codeql/javascript/ql/src/AngularJS/examples/DoubleCompilationGood.js
2018-08-02 17:53:23 +01:00

14 lines
418 B
JavaScript

angular.module('myapp')
.directive('addToolTip', function($compile) {
return {
link: function(scope, element, attrs) {
var tooltip = angular.element('<span ng-show="showToolTip">A tooltip</span>');
tooltip.on('mouseenter mouseleave', function() {
scope.$apply('showToolTip = !showToolTip');
});
element.append(tooltip);
$compile(tooltip)(scope); // OK
}
};
});