如何在ng-circle-progress imageSrc选项中附加图像?

时间:2019-05-31 12:21:30

标签: javascript angular image progress-bar angular7

我正在使用ng-circle-progress以角度7显示进度栏。

我按照此处给出的步骤操作:Progress-bar

以下是 HTML代码以显示进度栏:

<circle-progress
[percent]="85"
[radius]="23"
[outerStrokeWidth]="3"
[innerStrokeWidth]="3"
[outerStrokeColor]="'#78C000'"
[innerStrokeColor]="'#C7E596'"
[animation]="true"
[animationDuration]="1100"
[showTitle]="false"
[showUnits]="false"
[showSubtitle]="false"
[showImage]="true"
[imageSrc]="/assets/icons/music.svg"
[imageHeight]="23"
[imageWidth]="23"
></circle-progress>

但是它抛出一个错误:

  

错误TypeError:无法读取未定义的属性“ svg”

有什么可能的解决方案?

1 个答案:

答案 0 :(得分:1)

[imageSrc]="/assets/icons/music.svg"

You're providing a variable when you use that syntax.

Switch to either of those ones, but not a mix of it

imageSrc="/assets/icons/music.svg"
[imageSrc]="'/assets/icons/music.svg'"