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 6 typescript动态传递到animateTransform“;从「;属性_Svg_Angular6_Animatetransform - Fatal编程技术网

Svg 如何将数据从angular 6 typescript动态传递到animateTransform“;从「;属性

Svg 如何将数据从angular 6 typescript动态传递到animateTransform“;从「;属性,svg,angular6,animatetransform,Svg,Angular6,Animatetransform,我尝试了几种方法,以下是我的尝试: 在我的typescript文件中,我将该值设置为: this.value = "130"; //for first method this.rotation = "130 192 190"; //for second method 在component.html中时 <animateTransform attributeName="transform" type="rotate"

我尝试了几种方法,以下是我的尝试:

在我的typescript文件中,我将该值设置为:

this.value = "130"; //for first method
this.rotation = "130 192 190"; //for second method
在component.html中时

<animateTransform attributeName="transform"
                  type="rotate"
                  from="{{value}} 192 190"
                  to="0 192 190"
                  dur="3s"></animateTransform>

第二种方法:

<animateTransform attributeName="transform"
                  type="rotate"
                  [attr.from]="rotation"
                  to="0 192 190"
                  dur="3s"></animateTransform>


这两种方法都不起作用。有什么方法可以做到这一点吗?

只需将两者的优点结合起来:

this.value = "130"



您是否尝试过
[from]=“rotation”
?我刚刚尝试过,但遇到如下错误:“未处理的承诺拒绝:模板解析错误:无法绑定到'from',因为它不是的已知属性:':svg:animateTransform'”@FabianN。谢谢您的建议!我将部件[from]修改为[attr.from],它的工作方式就像charm!再次感谢!好的,我把它编辑成了答案。我只是不明白为什么
svg:animateTransform
的类型定义似乎丢失了,这应该可以在不必使用
attr的情况下工作。
现在这与第二种方法不一样吗?
<animateTransform attributeName="transform"
                  type="rotate"
                  [attr.from]="value + ' 192 190'"
                  to="0 192 190"
                  dur="3s"></animateTransform>