0
我目前在通过我的指令模板HTML生成此svg图像时遇到了问题。我正在使用AngularJS,但它是用CoffeeScript编写的。如何呈现AngularJS中对象中包含的SVG代码
.directive 'FileOutput',() ->
result =
restrict: "A"
replace: true
transclude: true
scope: {item: "="}
template: '<div>' +
'<div ng-if = "item.type == \'seg\'">{{item.data}}' +
'</div>'
的SVG对象的开始看起来像这样:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="3000px" height="3000px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="bg">
<rect x="0" y="0" width="3000px" height="3000px" style="fill:rgb(255,255,255);"/>
的代码,到目前为止,检查传入项对象,并检查是否项目。形式等于'赛格”。这部分工作正常。传入对象的第二部分是item.data,其中包含所有的SVG代码。到目前为止,我获得的最佳成功是在网页上显示原始代码。
我不知道如何实际呈现此原始代码中包含的图像。
任何帮助非常感谢!