【发布时间】:2019-09-07 12:48:51
【问题描述】:
我想使用本地 SVG 文件将 Clarity 框架图标替换为我自己的。我为此准备了一项服务:
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class IconServiceService {
icons: any = {
'caret': '<svg viewBox="0 0 100 100"><use xlink:href="file://help.svg#caret"></use></svg>',
};
constructor() { }
public load() {
window['ClarityIcons'].add(this.icons);
}
}
当我放置整个 SVG 内容而不是 <use xlink:href="file://help.svg#caret"> 部分时,它可以工作。但是,当我想链接到本地文件(如代码中所示)时,我无法获取该文件。我正在使用 Angular 7。如何在此处使用本地 SVG 文件?
【问题讨论】:
标签: angular svg icons vmware-clarity