我正在使用jQuery插件(我没有写)。我将插件包装在一个指令中,然后在其上调用$(element).jQueryFunction()
,插件会生成一堆HTML。插件生成的HTML并不是我想要的。修改生成的HTML的角度最佳做法是什么?在插件创建HTML后,有没有比使用jQuery选择器访问DOM更好的方法?
到目前为止我所拥有的:
//controller
angular.module('we', [])
.directive('jQueryPlugIn', function() {
return {
restrict: 'A',
link: function(scope, element) {
$(element).jQueryFunction({option1: "value1"});
$(".next").addClass("invisible"); //<------ is there a better way than this?
}
});
//view
<body>
<div j-query-plug-in></div>
</body>