Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将SVG与angular绑定_Angular_Svg - Fatal编程技术网

无法将SVG与angular绑定

无法将SVG与angular绑定,angular,svg,Angular,Svg,我正在尝试为矩形元素动态呈现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"></

我正在尝试为矩形元素动态呈现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}
];
*.html*
*.ts*
_rectList=[];
这是。\ rectList=[
{x:50,y:50},
{x:75,y:75},
{x:115,y:115}
];
尝试使用其他语法

*.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}
];
<rect [x]="item.x" [y]="item.y" ...></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}
];

非常感谢您的工作(第二个):)