5

在此处输入图像描述Angular2 材质复选框、工具栏和 nd 按钮组件正在使用 css 显示。但是 sidenav 没有与 css 一起显示。上面提供的图像。

使用的代码来自

https://www.npmjs.com/package/@angular2-material/sidenav

  <md-sidenav-layout fullscreen>
    <md-sidenav #start (open)="mybutton.focus()">
        Start Sidenav.
        <br>
        <button md-button #mybutton (click)="start.close()">Close</button>
    </md-sidenav>
    <md-sidenav #end align="end">
        End Sidenav.
        <button md-button (click)="end.close()">Close</button>
    </md-sidenav>

    My regular content. This will be moved into the proper DOM at runtime.
</md-sidenav-layout>

    My regular content. This will be moved into the proper DOM at runtime.
</md-sidenav-layout>

组件文件

import { Component } from "@angular/core";
import { MdSidenav } from '@angular2-material/sidenav';
import { MdCheckbox } from '@angular2-material/checkbox';
import { MdButton } from '@angular2-material/button';
import { MdToolbar } from '@angular2-material/toolbar';

@Component({
    selector: "my-sidebar",
    templateUrl: "app/sidebar.component.html",
    directives: [MdCheckbox, MdSidenav, MdButton, MdToolbar]
})
export class SidebarComponent {

}
4

0 回答 0