mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
31 lines
983 B
TypeScript
31 lines
983 B
TypeScript
/*
|
|
* Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
|
|
*
|
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
|
* pursuant to a written agreement and any use of this program without such an
|
|
* agreement is prohibited.
|
|
*/
|
|
|
|
import { Injectable } from '@angular/core';
|
|
import { MatIconRegistry } from '@angular/material/icon';
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class IconService {
|
|
contentIcons: string[] = ['workspace', 'menu', 'avatar'];
|
|
|
|
constructor(private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer) {}
|
|
|
|
public registerIcons(): void {
|
|
this.loadIcons(this.contentIcons, './assets/svg/icons');
|
|
}
|
|
|
|
private loadIcons(iconKeys: string[], iconUrl: string): void {
|
|
iconKeys.forEach((key) => {
|
|
this.matIconRegistry.addSvgIcon(key, this.domSanitizer.bypassSecurityTrustResourceUrl(`${iconUrl}/${key}.svg`));
|
|
});
|
|
}
|
|
}
|