我正在阅读一篇有关翻译的文章,并且已经到了here。在这一点上,作者已经说过以这种方式制定指令
app.directive('myCard', function() {
return {
scope: {
title: '=myTitle',
pic: '=myPic'
},
templateUrl: 'myCard',
transclude: true,
link: function(scope, el, attrs, ctrl, transclude) {
el.find('.content').append(transclude());
}
};
});
尴尬而且不可取。它建议改为在标签内部制作HTML
RewriteRule /about/(.*) http://www.domain.com/example/about/$1 [R=301,L].
是否有必要使用jQuery和DOM操作以这种方式使用指令?除了看起来更干净的模板之外,还有什么优势吗?不需要以这种方式附加?