I have followed the install instructions for angular2-mdl using the angular2-cli and I think everything is setup properly, the components I tested render and function correctly. I then tried getting the application layout sorted and componentized but ran into an issue.
When using the mdl-layout-header tag I get the following error in the console:
zone.js:140 Uncaught TypeError: Cannot read property 'name' of undefined
Currently my app.component.html has the following structure
<mdl-layout mdl-layout-fixed-header mdl-layout-header-seamed>
<mdl-layout-header>
<app-nav-bar></app-nav-bar>
</mdl-layout-header>
<mdl-layout-content>
<!--<router-outlet ></router-outlet>-->
Test
</mdl-layout-content>
</mdl-layout>
My nav-bar.component.html has the following structure
<mdl-layout-header-row>
<mdl-layout-title>My App</mdl-layout-title>
<mdl-layout-spacer></mdl-layout-spacer>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation">
<a class="mdl-navigation__link" >Link</a>
</nav>
</mdl-layout-header-row>
If I remove the mdl-layout-header tag the error goes away, but the header too.
If it helps in my app.module.ts I did import and include the MdlModule and I have included the required css files, no other imports specific to angular2-mdl have been done.
Any help would be greatly appreciated!
Thanks for the all the work that has been done so far!
Edit: I am currently using angular-cli version 1.0.0-beta.16 and angular2-mdl version 1.8.1.
My app.module.ts looks as follows:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { MdlModule } from 'angular2-mdl';
import { AppComponent } from './app.component';
import { NavBarComponent } from './nav-bar/nav-bar.component';
@NgModule({
declarations: [
AppComponent,
NavBarComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
MdlModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }