发布网友 发布时间:2022-04-19 23:47
共1个回答
热心网友 时间:2022-04-20 01:17
<html>// app.js
var app = angular.mole("MyApp", []);
app.directive("myWidget", function() {
var linkFunction = function(scope, element, attributes) {
var imag = element.children()[0];
$(imag).on("click", function() {
$(this).attr("src", "image2-url");
});
};
return {
restrict: "E",
link: linkFunction
};
});
可以用directive,代码如上!