Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Variables inside SVG

Tags:

angularjs

svg

Error: Invalid value for <text> attribute x="{{xForLabels.text}}"
angular.js:2390 Error: Invalid value for <text> attribute x="{{xForLabels.textNumber}}"
angular.js:2390 Error: Invalid value for <circle> attribute cx="{{xForLabels.circle}}"
angular.js:2390 Error: Invalid value for <text> attribute x="{{xForLabels.text}}"
angular.js:2390 Error: Invalid value for <text> attribute x="{{xForLabels.textNumber}}"

I use angular scope variables for attributes inside svg, everything works as i expect, but in console i get this errors. how to get rid of them? thank you.

like image 970
andrey Avatar asked Jan 09 '23 00:01

andrey


1 Answers

I think you should try ng-attr-x="{{xForLabels.text}}"

ref: https://docs.angularjs.org/guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes

like image 101
maxisam Avatar answered Jan 17 '23 19:01

maxisam