0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Angular Materialの雛形を作成する手順

Last updated at Posted at 2019-12-18

1.新しいAngularプロジェクトを作る

ng new myNewProject

2.新しいComponent (ページ的なもの)を作る

ng generate component pages/home

3.このコマンドを実行

ng add @angular/material

4.style.cssにこれを追加

* {
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body, html {
    height: 100%;
}

body {
    padding: 0;
    margin: 0;
}

5.ネットで見たすごいおじさんのコマンドを実行
ng generate @angular/material:material-nav --name=main-nav

6.app-routing.module.tsのroutesをこんな感じにする

const routes: Routes = [
  { path: '', component: HomeComponent },
];

7.App.component.htmlの中身をこれに書き換える

<app-main-nav>
  <router-outlet></router-outlet>
</app-main-nav>

8.main-nav.component.htmlのってところに

<ng-content></ng-content>

を書き加える。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?