【发布时间】:2015-03-29 20:18:57
【问题描述】:
我使用很多指令来绘制和操作复杂的 SVG。
从 1.3.??不推荐在指令工厂中使用“替换”。我想知道如何在不使用 replace: true 的指令中构建有效的 SVG。我的指令如下所示:
angular.module('app', []).directive('myRect', function() {
return {
restrict: 'E',
replace: true,
templateNamespace: 'svg',
template: '<rect x="20" y="20" width="100" height="50" fill="blue" />'
};
})
请参阅此plunk,了解两个 SVG 指令的示例,一个使用 replace: true,一个不使用。
【问题讨论】:
-
类似这样的后编译? stackoverflow.com/questions/24194972/…
-
@AardVark71 我会试试这个,如果没有其他解决方案,实际上删除任何
replace..
标签: javascript angularjs svg angularjs-directive