I do not think it has anything to do with the component being lazy-loaded.
LazyLoadedComponent is not part of the AppModule - it is part of the LazyModule. According to the docs, a component can only be part of one module. If you also try to add LazyLoadedComponent to the AppModule, you will receive an error message. Thus, LazyLoadedComponent does not even see the MdIconModule. You can confirm this by looking at the template output in the debugger - it has not changed.
<md-icon svgIcon="play"></md-icon>
The solution is similar to adding MdIconModule to LazyModule, and although this alone does not fix the problem, it adds an error to the output.
Error receiving icon: Error: Cannot find an icon with the name ": play"
And now the output of the template looks like this, so we know that it is loading.
<md-icon role="img" svgicon="play" ng-reflect-svg-icon="play" aria-label="play"></md-icon>
I added the addSvgIconSet call from LazyLoadedComponent and got it working ... so this proves that there is an instance of the MdIconRegistry service for each component - not what you want, but you can point it in the right direction.
Here is a new plot - http://plnkr.co/edit/YDyJYu?p=preview
After further review, I found this in docs :
Why is the service provided in a lazy loaded module visible only to that module?
Unlike suppliers of modules loaded at startup, suppliers of lazy loaded modules are modulated.
The final update! Here is the answer. MdIconModule is not configured correctly for lazy downloadable components ... but we can easily create our own module that is configured correctly and uses it.
import { NgModule } from '@angular/core'; import { HttpModule } from '@angular/http'; import { MdIcon } from '@angular2-material/icon'; import { MdIconRegistry } from '@angular2-material/icon'; @NgModule({ imports: [HttpModule], exports: [MdIcon], declarations: [MdIcon] }) export class MdIconModuleWithProviders { static forRoot(): ModuleWithProviders { return { ngModule: MdIconModuleWithProviders, providers: [ MdIconRegistry ] }; } }
Plunk is updated and fully operational. (sorry, updated the same) β http://plnkr.co/edit/YDyJYu?p=preview
You can send a transfer request so that Angular Material exports modules of both styles.