简体   繁体   English

无法使用角度绑定 SVG

[英]Unable to Bind SVG with angular

I am trying to render the x and y-axis dynamically for the rectangle element while getting it to the .html page i am facing error like "Can't bind to 'x' since it isn't a known property of ':svg:rect'. (" "我正在尝试为矩形元素动态呈现 x 轴和 y 轴,同时将其获取到 .html 页面我面临的错误是“无法绑定到 'x',因为它不是 ':svg 的已知属性:rect'. (" "

*.html *


     <svg x="100" y="500">
      <g *ngFor="let item of _rectList" >
        <rect  x="{{item.x}}" y="{{item.y}}" height="25" width="50"></rect>
      </g>
    </svg>




*.ts*


 _rectList =[];


      this. _rectList= [
{x: 50, y: 50},
{x: 75, y: 75},
{x: 115, y: 115}
];

Try using other syntax尝试使用其他语法

<rect [x]="item.x" [y]="item.y" ...></rect>

or或者

<rect [attr.x]="item.x" [attr.y]="item.y" ...></rect>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM