I'm using Angular 2 rc 5
with ng2-Material alpha 7-2
.
The basic problem is that using <md-icon svgIcon='icon'>
to show the same icon from the same svg file will work in one component but not the other even though MdIconModule
and MdIconRegistry
are provided to the root AppModule
To replicate the problem
- Open this plunker
- Notice that
MdIconModule
andMdIconRegistry
are imported as part ofMaterialModule.forRoot()
into the mainAppModule
- Open the
AppComponent
and notice the call toaddSvgIconSet()
to register icons - In the template,
<md-icon svgIcon='ic_account_box_24px'>
is used to display the icon. In the view the icon is shown successfully above the nav bar. - Open
app/crisis-center/crisis.list.component
and open the Crisis Center in the view. - Note in the template, the same
<md-icon>
is present. However, no icon is displayed above the crisis list in the view. The DOM inspector from browser dev tools shows that the angular parser didn't even recognize it as an angular component (in the dom, it's left exactly as in the code)
Because I imported the icon module and service into the root module I expected the service to be a singleton available to the whole app. Since I use that service to register the icons with iconRegistry.addSvgIconSet()
in my bootstrapped AppComponent
, I expected the icons to be accessible throughout the app.
PS: this may be related to what I reported yesterday, although in that case the app crashes; in this case the icon is just not shown.