Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit bd07936

Browse files
johnpapawardbell
authored andcommitted
docs(style-guide): add A2 styleguide - v1
1 parent 4c286e4 commit bd07936

File tree

14 files changed

+850
-3
lines changed

14 files changed

+850
-3
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// #docplaster
2+
3+
// #docregion
4+
/* recommended */
5+
6+
// app.component.ts
7+
import { Component, OnInit } from 'angular2/core';
8+
9+
import { Hero } from './hero';
10+
import { HeroService } from './hero.service';
11+
12+
@Component({
13+
selector: 'my-app',
14+
template: `
15+
<pre>{{heroes | json}}</pre>
16+
`,
17+
styleUrls: ['app/app.component.css'],
18+
providers: [HeroService]
19+
})
20+
export class AppComponent implements OnInit{
21+
heroes: Hero[] = [];
22+
23+
constructor(private _heroService: HeroService) {}
24+
25+
ngOnInit() {
26+
this._heroService.getHeroes()
27+
.then(heroes => this.heroes = heroes);
28+
}
29+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// #docplaster
2+
3+
// #docregion
4+
/* recommended */
5+
6+
export class Hero {
7+
id: number;
8+
name: string;
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// #docplaster
2+
3+
// #docregion
4+
/* recommended */
5+
6+
import { Injectable } from 'angular2/core';
7+
import { HEROES } from './mock-heroes';
8+
9+
@Injectable()
10+
export class HeroService {
11+
getHeroes() {
12+
return Promise.resolve(HEROES);
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// #docplaster
2+
3+
// #docregion
4+
/* recommended */
5+
6+
import { bootstrap } from 'angular2/platform/browser';
7+
import { AppComponent } from './app.component';
8+
9+
bootstrap(AppComponent, []);
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// #docplaster
2+
3+
// #docregion 001-1
4+
/* avoid */
5+
import { bootstrap } from 'angular2/platform/browser';
6+
import { Component, OnInit } from 'angular2/core';
7+
8+
@Component({
9+
selector: 'my-app',
10+
template: `
11+
<h1>{{title}}</h1>
12+
<pre>{{heroes | json}}</pre>
13+
`,
14+
styleUrls: ['app/app.component.css']
15+
})
16+
export class AppComponent implements OnInit{
17+
title = 'Tour of Heroes';
18+
19+
heroes: Hero[] = [];
20+
21+
ngOnInit() {
22+
getHeroes().then(heroes => this.heroes = heroes);
23+
}
24+
}
25+
26+
bootstrap(AppComponent, []);
27+
28+
function getHeroes() {
29+
return // some promise of data;
30+
}
31+
// #enddocregion 001-1
32+
33+
34+
// #docregion 001-2
35+
/* recommended */
36+
37+
// main.ts
38+
import { bootstrap } from 'angular2/platform/browser';
39+
import { AppComponent } from './app.component';
40+
41+
bootstrap(AppComponent, []);
42+
/* recommended */
43+
44+
// app.component.ts
45+
import { Component, OnInit } from 'angular2/core';
46+
47+
import { Hero } from './hero';
48+
import { HeroService } from './hero.service';
49+
50+
@Component({
51+
selector: 'my-app',
52+
template: `
53+
<pre>{{heroes | json}}</pre>
54+
`,
55+
styleUrls: ['app/app.component.css'],
56+
providers: [HeroService]
57+
})
58+
export class AppComponent implements OnInit{
59+
heroes: Hero[] = [];
60+
61+
constructor(private _heroService: HeroService) {}
62+
63+
ngOnInit() {
64+
this._heroService.getHeroes()
65+
.then(heroes => this.heroes = heroes);
66+
}
67+
}
68+
// #enddocregion 001-2
69+
70+
// #docregion 001-3
71+
/* recommended */
72+
73+
// hero.service.ts
74+
import { Injectable } from 'angular2/core';
75+
import { HEROES } from './mock-heroes';
76+
77+
@Injectable()
78+
export class HeroService {
79+
getHeroes() {
80+
return Promise.resolve(HEROES);
81+
}
82+
}
83+
// #enddocregion 001-3
84+
85+
// #docregion 001-4
86+
/* recommended */
87+
88+
// hero.ts
89+
export class Hero {
90+
id: number;
91+
name: string;
92+
}
93+
// #enddocregion 001-4

public/docs/_examples/router/ts/index.html renamed to public/docs/_examples/style-guide/ts/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<base href="/">
88
<!-- #enddocregion base-href -->
99

10-
<title>Router Sample</title>
10+
<title>Style Guide Sample</title>
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
1212
<link rel="stylesheet" href="styles.css">
1313

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"description": "Style Guide",
3+
"files":[
4+
"!**/*.d.ts",
5+
"!**/*.js"
6+
],
7+
"tags": ["style guide, styleguide"]
8+
}

public/docs/dart/latest/guide/_data.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@
103103
"title": "Structural Directives",
104104
"intro": "Angular has a powerful template engine that lets us easily manipulate the DOM structure of our elements."
105105
},
106-
106+
107+
"style-guide": {
108+
"title": "Style Guide",
109+
"intro": "Write Angular 2 with style.",
110+
"hide": true
111+
},
112+
107113
"testing": {
108114
"title": "Testing",
109115
"intro": "Techniques and practices for testing an Angular 2 app",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!= partial("../../../_includes/_ts-temp")

0 commit comments

Comments
 (0)