According to my understanding of Angular 2 rc5
, to make a service from another module (not AppModule
) available as a singleton to every component,
New to Angular 6 there is a new way to register a provider as a singleton. Inside the @Injectable() decorator for a service, use the providedIn attribute. Set its value to 'root'. Then you won't need to add it to the providers list of the root module, or in this case you could also set it to your MdIconModuleWithProviders module like this:
@Injectable({
providedIn: MdIconModuleWithProviders // or 'root' for singleton
})
export class MdIconRegistry {
...