Html 如何将AngularJS与SVG标记一起使用?我想在SVG标记中从angular传递一个参数

Html 如何将AngularJS与SVG标记一起使用?我想在SVG标记中从angular传递一个参数,html,angularjs,svg,angularjs-directive,Html,Angularjs,Svg,Angularjs Directive,我想通过AngularJS从用户那里获取输入,并将其应用到SVG圆圈标记上。有人能帮我吗 我现在做的是: <div class="app" ng-app> <div ng-controller="ctrlSizing"> <label>Radius: <input ng-model="rad" type="number" placeholder="How about 300?"> </label> &

我想通过AngularJS从用户那里获取输入,并将其应用到SVG圆圈标记上。有人能帮我吗

我现在做的是:

<div class="app" ng-app>
  <div ng-controller="ctrlSizing">
    <label>Radius:
      <input ng-model="rad" type="number" placeholder="How about 300?">
    </label>
  </div>
</div>
<div style="height: 800; width: 500; position:absolute; left: 100px;top: 100px;">
  <svg width="500" height="500" visibility="visible">
    <circle id="circle1" cx="150" cy="150" r="getRad()" stroke="black" stroke-width="2" fill="grey" />
  </svg>
</div>

半径:

在圆上使用
ng-attr-r
而不是
r
属性

标记

<div data-ng-controller="AppCtrl" id="ctrl">
    <input data-ng-model="rad"> {{rad}}
    <div style="height: 800; width: 500; position:absolute; left: 100px;top: 100px;">
            <svg width="500" height="500" visibility="visible" >
                <circle id="circle1" cx="150" cy="150" ng-attr-r="{{rad}}" stroke="black" stroke-width="2" fill="grey" />
            </svg>
    </div>
</div>

{{rad}}