Using the any provider scope for a configurable ThemeService
Let's use the any provider scope for a configurable ThemeService
by injecting configurable settings depending on the use case for each module that we load:
@Injectable({ providedIn: 'any', }) export class ThemeService { constructor(@Inject(themeToken) private theme: ITheme) {} public setSetting(name: string, value: string): void { this.setItem(name, value); } public getSetting(name: string): string { switch (name) { case 'background': return this.getItem(name) ?? this.theme.background; case 'tileBackground': return this.getItem(name) ?? this.theme.tileBackground...