angularjs - <path> 的 svg 无效值

标签 angularjs svg

我在输入 SVG 路径 d = ""时遇到问题。我不明白这个错误信息。

html:

<svg style="height:300px">
   <path d="{{ room.coordinate }}" ng-repeat="room in rooms" fill="blue" stroke="black" stroke-width="2"></path>
</svg>

SVG路径:M 150 0 L75 200 L225 200 Z

错误:
Error: Invalid value for <path> attribute d="{{ room.coordinate }}" jquery.min.js:3
Error: Invalid value for <path> attribute d="{{ room.coordinate }}" angular.min.js:23

最佳答案

这与这个问题有关:D3 Integration with Angular: "Error: Invalid value for <rect> attribute x"

而这个问题:https://github.com/angular/angular.js/pull/2061

<svg>属性,ng-attr-<name>={{<evaluated value>}}应该用来代替 <name>={{<evaluated value>}} .

关于angularjs - <path> 的 svg 无效值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25923377/

相关文章:

javascript - AngularJS 从 Controller 更新 ng-click 范围

javascript - 在 Angular js 中添加 header 时,HTTP GET 请求更改为 OPTIONS

javascript - 交互式白板应用程序中的不同屏幕尺寸

d3.js - d3 追加和输入问题

javascript - 使用 TypeScript 类编写 Angular 指令

python - 如何从 AngularJS 应用程序调用 Python 脚本

javascript - 使用 d3 修改 HTML 中的 SVG

javascript - 更新 HTML 以使用 JavaScript 或 jQuery 结束标记

html - 将图像放在我的 HTML 页面上 SVG 图像的右侧而不是底部

javascript - AngularJS 嵌套 ng-repeat