return {
restrict: 'EA',
link: function (scope, element, attr) {
element.bind('mouseenter', function() {
this.after("<div style='position: absolute;'><img src=" + this.src + " /></div>")
});
}
}
比如像上边这样,使用jquery的after方法,这个div在页面显示成了字符串,怎么才能直接解析出来?
利用 $compile
写了个在线小demo
http://embed.plnkr.co/egEOkZv...