<div ng-app="testrectApp">
<svg>
<rect height="10" width="10" style="fill: #00ff00" />
<testrect />
</svg>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的指示
module.directive('testrect', function() {
return {
restrict: 'E',
template: '<rect top="20" left="20" height="10" width="10" style="fill: #ff00ff" />',
replace: true
};
});
Run Code Online (Sandbox Code Playgroud)
但这就是元素最终看起来像在浏览器中.填充两次不是拼写错误.
<rect top="20" left="20" height="10" width="10" style="fill: #ff00ff;fill: #ff00ff"></rect>
Run Code Online (Sandbox Code Playgroud)
这是一个jsfiddle http://jsfiddle.net/RG2CF/
是我想做的不可能还是我做错了什么?
谢谢
编辑:我应该补充一点,这个问题可能与模板svg rect被命名为xhtml而不是svg的事实有关,但我不确定如何强制这个或命名空间它回到svg,如果实际上是解决方案.