任何人都可以建议我使用JS函数来使这个SVG可见,因为它在没有角度JS的情况下工作得很完美。
<div class="app" ng-app ng-style="disableCircle">
<div ng-controller="ctrlSizing">
<label id="rad" style="visibility: hidden">Radius: <input ng-model="rad" type="number" placeholder="How about 300?"></label>
<div id="circle" style="height: 800; width: 500; position:absolute; left: 100px;top: 100px;">
<svg width="500" height="500" visibility="visible" onclick="cInput()" >
<circle id="circle1" cx="150" cy="150" ng-attr-r="{{rad}}" stroke="black" stroke-width="2" fill="grey" />
</svg>
</div>
</div>
</div>
<div>
<input id="button1" type="button" value="Circle" onclick="circleDraw()">
</div>
答案 0 :(得分:-1)
使用JS隐藏由id检索的元素或遍历DOM。
svgElement.style.display = "none";
或
svgElement.style.opacity = 0;
有关如何使用JS与SVG交互的更多信息,请查看本文Interfacing with SVG