Skip to content

Commit a956227

Browse files
ThomasBurlesonhansl
authored andcommitted
docs: update flex-layout story
1 parent 694deb9 commit a956227

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
# Include [Flex Layout](https://github.com/angular/flex-layout) in your CLI application
1+
## Include [Flex Layout](https://github.com/angular/flex-layout) in your CLI application
22

3-
Include Angular Flex layout as detailed above.
3+
<a href="https://tburleson-layouts-demos.firebaseapp.com/#/docs" target="_blank">
4+
<img src="https://user-images.githubusercontent.com/210413/28999595-65e9be78-7a11-11e7-9403-69ecae10fcb4.png"></img>
5+
</a>
46

5-
Install the `@angular/flex-layout` library and add the dependency to package.json...
7+
> Above is snapshot of a [Online Demos](https://tburleson-layouts-demos.firebaseapp.com/#/docs) using @angular/flex-layout
8+
9+
10+
<br/>
11+
12+
### Include `@angular/flex-layout` as detailed below:
13+
14+
Install the library and add the dependency to package.json...
615
```bash
716
npm install --save @angular/flex-layout
817
```
918

19+
Or install the nightly build using:
20+
21+
```bash
22+
npm i --save @angular/flex-layout-builds
23+
```
24+
1025
Import the Angular Flex-Layout NgModule into your app module...
1126
```javascript
1227
//in src/app/app.module.ts
@@ -25,53 +40,45 @@ import { FlexLayoutModule } from '@angular/flex-layout';
2540

2641
Run `ng serve` to run your application in develop mode, and navigate to `http://localhost:4200`
2742

28-
Add the following to `src/app/app.component.css`...
29-
```css
30-
.header {
31-
background-color: lightyellow;
32-
}
43+
<br/>
3344

34-
.left {
35-
background-color: lightblue;
36-
}
45+
### Sample App
3746

38-
.right {
39-
background-color: pink;
40-
}
47+
Add the following to `src/app/app.component.css`...
48+
```css
49+
[fxLayout="column"] { border: 1px solid;padding:4px; margin-top:50px; },
50+
[fxFlex]{ padding:5px;},
51+
h3 { padding-top:20px; },
52+
.header { background-color: lightyellow; },
53+
.left { background-color: lightblue; },
54+
.right { background-color: pink; }
4155
```
4256

4357
To verify flex-layout has been set up correctly, change `src/app/app.component.html` to the following...
4458
```html
45-
<div fxLayout="column">
46-
47-
<div class="header" fxLayout="row" fxLayoutAlign="space-between center">
48-
49-
<h1>
50-
{{title}}
51-
</h1>
52-
53-
</div>
54-
55-
<div fxLayout="row">
56-
57-
<div class="left" fxFlex="20">
58-
LEFT: 20% wide
59-
</div>
60-
61-
<div class="right" fxFlex>
62-
RIGHT: 80% wide
63-
</div>
64-
65-
</div>
66-
</div>
67-
```
59+
<div fxLayout="column">
60+
<div class="header" fxLayout="row" fxLayoutAlign="space-between center">
61+
<h3>
62+
{{title}}
63+
</h3>
64+
</div>
65+
<div fxLayout="row">
66+
<div class="left" fxFlex="20"> LEFT: 20% wide </div>
67+
<div class="right" fxFlex> RIGHT: 80% wide </div>
68+
</div>
69+
</div>
70+
```
6871

6972
After saving this file, return to the browser to see the very ugly but demonstrative flex-layout.
7073

74+
![screen shot 2017-08-05 at 7 20 05 pm](https://user-images.githubusercontent.com/210413/28999629-35c566a0-7a13-11e7-8d36-1d1a2244443c.png)
75+
7176
Among what you should see are - a light yellow header that is the entire width of the window, sitting directly atop 2 columns. Of those 2 columns, the left column should be light blue, and 20% wide, while the right column is pink, 80% to start, and will flex with window (re)size.
7277

78+
<br/>
79+
7380
### More Info
7481

75-
- [Installation](https://github.com/angular/flex-layout#installation)
76-
- [API Overview](https://github.com/angular/flex-layout/wiki/API-Overview)
82+
- [Installation](https://github.com/angular/flex-layout/wiki/Using-Angular-CLI)
83+
- [API Overview](https://github.com/angular/flex-layout/wiki/Declarative-API-Overview)
7784
- [Demo](https://tburleson-layouts-demos.firebaseapp.com/#/docs)

0 commit comments

Comments
 (0)