angular - 如何在 Angular v4.0 中使用 Snap.svg(错误 : circle is not a function)

标签 angular snap.svg

我不知道如何在 Angular v4.0 中使用 Snap.svg,所以我读了 this邮政。我尝试了@moeabdol ( npm install ..., scripts: ..., declare ..., s.circle(...) ) 的解决方案,但出现以下错误:

ERROR TypeError: s.circle is not a function



但是,我可以使用 Snap.load(...) 加载外部 SVG .

为什么是 s.circle不为我工作?

最佳答案

确保您在 svg 上绘图而不是 div .我也犯过这个错误。

在您的 HTML 中: <svg id="editor-canvas"></svg>
在您的组件中: const s = Snap("#editor-canvas"); const c = s.circle(100, 100, 100);

关于angular - 如何在 Angular v4.0 中使用 Snap.svg(错误 : circle is not a function),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51648389/

相关文章:

angular - 无法让 ngPlural 运行 Angular

html - 使用 ngFor 将数据传递给嵌套组件

angular - 如何在 Angular v4.0 中使用 Snap.svg

javascript - 捕捉 svg 动画不需要的裁剪

javascript - 如何将 SVG 图像放置在 TextPath 上文本的开头

javascript - D3JS 或 SNAPSVG 拖放仅限于加载的 svg 形状区域

angular - 将 Observables 转换为 Promise 的任何缺点

javascript - Angular react 形式 - 绑定(bind) [value] 之外的另一个属性

angular - 如何使用 Angular Material snackbar 检查解雇原因?

javascript - snap.svg 在圆圈中移动对象