diff --git a/projects/ng-aquila/src/icon/icon.md b/projects/ng-aquila/src/icon/icon.md index 58c7ea911..7aaffcff0 100644 --- a/projects/ng-aquila/src/icon/icon.md +++ b/projects/ng-aquila/src/icon/icon.md @@ -75,7 +75,7 @@ The filled option should only be used with **product** icons. ### Register icons service -Custom icons can be registered via the `NxIconRegistry` injectable service. With the `NxIconRegistry` you can associate icon names with SVG, URL and HTML strings and define a CSS font class. +Custom icons can be registered via the `NxIconRegistry` injectable service. With the `NxIconRegistry` you can associate icon names with SVG, URL and HTML strings and define a CSS font class. When you are registering an icon by URL please make sure to import the `HttpClientModule` from `@angular/common/http`. diff --git a/projects/ng-aquila/src/icon/icons.ts b/projects/ng-aquila/src/icon/icons.ts index c6f31d1c3..d380cdfb4 100644 --- a/projects/ng-aquila/src/icon/icons.ts +++ b/projects/ng-aquila/src/icon/icons.ts @@ -71,6 +71,10 @@ export class NxSvgIconFromUrl extends NxSvgIcon { throw Error(`The URL provided to NxIconRegistry was not trusted as a resource URL ` + `via Angular's DomSanitizer. Attempted URL was "${safeUrl}".`); } + if (!this._httpClient) { + throw Error('Could not find HttpClient provider for using a SVG url in the nx-icon registry. ' + + 'Please include the HttpClientModule from @angular/common/http in your app imports.'); + } } /** Returns the content. If the SVG is not already loaded it fetches the SVG from icons' URL */