|
1 | 1 | <div class="demo-page"> |
2 | 2 | <div class="markdown-body"> |
3 | | - <h1>Getting Started</h1> |
4 | | - Using Angular CLI? <a [routerLink]="['/cli-guide']">Angular CLI - Getting Started</a> |
| 3 | + <h1>Getting started</h1> |
| 4 | + <h2>Step 1: Install Angular CLI</h2> |
| 5 | + Already have @angular/cli installed? Skip to Step 2. |
5 | 6 |
|
6 | | - <h2>Step 1: Install Angular MDC</h2> |
7 | 7 | <h4>npm</h4> |
8 | | - <pre>npm i @angular-mdc/web</pre> |
| 8 | + <pre><code highlight lang="bash">npm i -g @angular/cli</code></pre> |
| 9 | + <h4>yarn</h4> |
| 10 | + <pre><code highlight lang="bash">yarn global add @angular/cli</code></pre> |
| 11 | + |
| 12 | + <h2>Step 2: Create Project</h2> |
| 13 | + If generating a new project, you need to set default CSS preprocessor to SCSS: |
| 14 | + <pre><code highlight lang="bash">ng new your-project-name |
| 15 | + cd PROJECT-NAME</code></pre> |
| 16 | + |
| 17 | + On existing projects, you need to set default CSS preprocessor to SCSS: |
| 18 | + <pre><code highlight>ng config schematics.@schematics/angular:component.styleext scss</code></pre> |
| 19 | + |
| 20 | + <h2>Step 3: Install Angular MDC</h2> |
| 21 | + <h4>npm</h4> |
| 22 | + <pre><code highlight lang="bash">npm i @angular-mdc/web</code></pre> |
9 | 23 |
|
10 | 24 | <h4>yarn</h4> |
11 | | - <h4><pre>yarn add @angular-mdc/web</pre></h4> |
| 25 | + <pre><code highlight lang="bash">yarn add @angular-mdc/web</code></pre> |
12 | 26 |
|
13 | | - <h2>Step 2: Import components</h2> |
| 27 | + <h2>Step 4: Import Angular MDC Sass</h2> |
| 28 | + Edit src/styles.sass, and insert: |
| 29 | + <pre><code highlight lang="scss"> |
| 30 | +$mdc-theme-primary: #1565c0; // primary color |
| 31 | +$mdc-theme-secondary: #388e3c; // secondary color |
| 32 | + |
| 33 | +@import "~@angular-mdc/theme/material" |
| 34 | +</code></pre> |
| 35 | + |
| 36 | + <h2>Step 5: Import Components</h2> |
14 | 37 | Now just import the NgModule for each component you want to use. |
15 | | - <pre><![CDATA[import { |
| 38 | + <pre><code highlight code="import { |
16 | 39 | MdcFabModule, |
| 40 | + MdcIconModule, |
17 | 41 | MdcMenuModule |
18 | 42 | } from '@angular-mdc/web'; |
19 | 43 |
|
20 | 44 | @NgModule({ |
21 | 45 | ... |
22 | 46 | imports: [ |
23 | 47 | MdcFabModule, |
24 | | - MdcIconModule, |
| 48 | + MdcIconModule |
25 | 49 | MdcMenuModule, |
26 | 50 | ... |
27 | 51 | ], |
28 | 52 | ... |
29 | 53 | }) |
30 | | - export class ExampleModule { }]]></pre> |
31 | | - |
32 | | - <h2>Step 3: Import Angular MDC Theme</h2> |
33 | | - Import the Angular MDC theme into your project Sass: |
34 | | - <pre><![CDATA[ |
35 | | -$mdc-theme-primary: #1565c0; // primary color |
36 | | -$mdc-theme-secondary: #388e3c; // secondary color |
37 | | - |
38 | | -@import "~@angular-mdc/theme/material";]]></pre> |
| 54 | + export class ExampleModule { }"></code></pre> |
39 | 55 |
|
40 | | - <h2>Step 4: Include Material Design Icons</h2> |
41 | | - Add the <a href="https://material.io/icons/" target="_blank" rel="noopener noreferrer">Material Design Icons</a> collection to your index.html. |
42 | | - <pre><![CDATA[<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">]]></pre> |
| 56 | + Open app.component.html and add the following markup: |
| 57 | + <pre><code highlight code="<button mdc-button raised>My Button</button> |
43 | 58 |
|
44 | | - <h2>Step 5: Include Roboto Font</h2> |
45 | | - Add the Roboto font with 300, 400 and 500 weights to your index.html. |
| 59 | +<button mdc-fab> |
| 60 | + <mdc-icon>edit</mdc-icon> |
| 61 | +</button>"></code></pre> |
46 | 62 |
|
47 | | - <pre><![CDATA[<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">]]></pre> |
| 63 | + Run `ng serve` to run your application in develop mode, and navigate to http://localhost:4200 |
48 | 64 | </div> |
49 | 65 | </div> |
0 commit comments