For a given layout from the demo-app http://mseemann.io/angular2-mdl/layout
<div class="demo-container" mdl-shadow="2">
<mdl-layout mdl-layout-fixed-header mdl-layout-header-seamed>
<mdl-layout-header>
<mdl-layout-header-row>
<mdl-layout-title>Title</mdl-layout-title>
<mdl-layout-spacer></mdl-layout-spacer>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation mdl-layout--large-screen-only">
<a class="mdl-navigation__link" href>Link</a>
<a class="mdl-navigation__link" href>Link</a>
<a class="mdl-navigation__link" href>Link</a>
</nav>
</mdl-layout-header-row>
</mdl-layout-header>
<mdl-layout-drawer>
<mdl-layout-title>Title</mdl-layout-title>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href>Link</a>
<a class="mdl-navigation__link" href>Link</a>
<a class="mdl-navigation__link" href>Link</a>
</nav>
</mdl-layout-drawer>
<mdl-layout-content>
<router-outlet ></router-outlet>
</mdl-layout-content>
it works if I copy paste directly in app.html but if I break it up in reusable components. Let's say:
<div class="demo-container" mdl-shadow="2">
<mdl-layout mdl-layout-fixed-header mdl-layout-header-seamed>
<header-comp></header-comp>
<drawer-comp></drawer-comp>
<mdl-layout-content>
<router-outlet ></router-outlet>
</mdl-layout-content>
Where <header-comp></header-comp>
and <drawer-comp></drawer-comp>
encapsulate part of the layout markup (<mdl-layout-header>...</mdl-layout-header>
and <mdl-layout-drawer>...</mdl-layout-drawer>
respectively)
Both components does not render anything in place
I am running Angular2 "2.0.0" (the brand new official final release) and angular-mdl "1.7.1" with Webpack as module bundler. It is good to say that all angular2-mdl directives rendered inside router-outlet are rendered properly. This leads to think that angular2-mdl is properly imported and installed.
More specifically, in app.module.ts
:
@NgModule({
imports: [
CommonModule,
FormsModule,
homeRouting,
MdlModule
],
and both in header.ts
and drawer.ts
:
providers: [
MdlLayoutComponent
]
By last if I move one of my reusable component (let's say: <header-comp></header-comp>
) out of the mark up (see below). The template content is rendered properly although the layout looks broken (as expected)
<header-comp></header-comp>
<div class="demo-container" mdl-shadow="2">
<mdl-layout mdl-layout-fixed-header mdl-layout-header-seamed>
<drawer-comp></drawer-comp>
<mdl-layout-content>
<router-outlet ></router-outlet>
</mdl-layout-content>
I can workaround it using plain mdl or duplicating code but... what is happening?
Cheers