I would like to use Adobe Spectrum in my Angular application. Spectrum is installed as a node module using the following command:
npm install @adobe/spectrum-css
"you'll need to use the loadIcons() function. This function lives in the icons/loadIcons.js file and has the following signature:
loadIcons(svgURL {String}, callback {Function});
How can the icons/loadIcons.js file from the node_module be imported and used with Angular?
Update
I have changed angular.json
"scripts": [
"./src/assets/spectrum/dist/icons/loadIcons.js"
]
And app.component.ts
import { Component, OnInit } from '@angular/core';
declare function loadIcons(svgURL: string): any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'client';
ngOnInit() {
loadIcons('icons/spectrum-css-icons.svg');
}
}
It looks like loadIcons(); is working now, but getting the following error in the Chrome Dev Tools:
GET http://localhost:4200/icons/spectrum-css-icons.svg 404 (Not Found)
loadIcons.js:32 Error: loadIcons: Failed to fetch icons, server returned 404
Where should the icons directory be placed? I have them in both the project root, and under ./src
.