メソッドが呼び出されstart.toggle()
たときに関数 (Angular 2 マテリアル md-sidenav-layout コンポーネントに属する)を開始したいと考えています。test()
app.component.ts で md-sidenav-layout を呼び出す方法start.toggle()
は?
app.component.html
<md-sidenav-layout class="sidenav" fullscreen>
<md-sidenav #start>
Start Side Drawer
<br>
<md-nav-list>
<a md-list-item [routerLink]="['']">Home</a>
<a md-list-item [routerLink]="['about']">About</a>
</md-nav-list>
<button md-button (click)="start.close()">Close</button>
</md-sidenav>
<div class="content">
<button md-button (click)="start.toggle()">Toggle Start Side Drawer</button>
<button md-button (click)="test()">Test Button</button>
<main>
<router-outlet></router-outlet>
</main>
<footer>
</footer>
</div>
</md-sidenav-layout>
app.component.ts
import {Component} from '@angular/core';
// what to import here?
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
constructor() {
}
test() {
// how to call md-sidenav-layout start.toggle() properly here?
start.toggle();
}
}