I need to change height of foreignObject in svg dynamically. I have to use foreignObject as I need html elements inside it. (I'm working with ngx-graph).
<foreignObject x="1" y="1" width="335" [height]="foreignObjHeight(node.Data.length)" > ...
I'm getting error:
TypeError: Cannot set property height of [object SVGForeignObjectElement] which has only a getter
Please help!
CodePudding user response:
In your case you can just set the height attribute to its value :
<foreignObject x="1" y="1" width="335" [attr.height]="foreignObjHeight(node.Data.length)" ">