双绑定 angular 2 与 SVG
Double binding angular 2 with SVG
我正在编写一个 Angular 2 应用程序,我不明白为什么 Angular 不能正常使用
<rect x={{rect.x}} y={{rect.y}} width={{rect.width}} height={{rect.height}} fill={{rect.fill}} stroke={{rect.stroke}} />
<path [d]="M0,0 v rect.height h rect.width v- rect.height z" />
这应该有效
<rect [attr.x]="rect.x" [attr.y]="rect.y" [attr.width]="rect.width" [attr.height]="rect.height"
[attr.fill]="rect.fill" [attr.stroke]="rect.stroke" />
x={{rect.x}}
(相当于[x]="rect.x"
是属性绑定语法但是这些SVG属性需要属性绑定。
我正在编写一个 Angular 2 应用程序,我不明白为什么 Angular 不能正常使用
<rect x={{rect.x}} y={{rect.y}} width={{rect.width}} height={{rect.height}} fill={{rect.fill}} stroke={{rect.stroke}} />
<path [d]="M0,0 v rect.height h rect.width v- rect.height z" />
这应该有效
<rect [attr.x]="rect.x" [attr.y]="rect.y" [attr.width]="rect.width" [attr.height]="rect.height"
[attr.fill]="rect.fill" [attr.stroke]="rect.stroke" />
x={{rect.x}}
(相当于[x]="rect.x"
是属性绑定语法但是这些SVG属性需要属性绑定。