diff --git a/public/docs/_examples/toh-1/ts/app/app.component.ts b/public/docs/_examples/toh-1/ts/app/app.component.ts
index b61fac3c0b..d2853fbd5c 100644
--- a/public/docs/_examples/toh-1/ts/app/app.component.ts
+++ b/public/docs/_examples/toh-1/ts/app/app.component.ts
@@ -13,10 +13,14 @@ export class Hero {
template: `
-
-
-
-
{{hero.name}}
-
+
+
diff --git a/public/docs/_examples/toh-5/ts/app/dashboard.component.ts b/public/docs/_examples/toh-5/ts/app/dashboard.component.ts
index 6dd4b1abc2..3e96a0710a 100644
--- a/public/docs/_examples/toh-5/ts/app/dashboard.component.ts
+++ b/public/docs/_examples/toh-5/ts/app/dashboard.component.ts
@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
// #docregion import-router
import { Router } from '@angular/router';
// #enddocregion import-router
+import { ROUTER_DIRECTIVES } from '@angular/router';
import { Hero } from './hero';
import { HeroService } from './hero.service';
@@ -14,8 +15,9 @@ import { HeroService } from './hero.service';
templateUrl: 'app/dashboard.component.html',
// #enddocregion template-url
// #docregion css
- styleUrls: ['app/dashboard.component.css']
+ styleUrls: ['app/dashboard.component.css'],
// #enddocregion css
+ directives: [ROUTER_DIRECTIVES]
})
// #docregion component
export class DashboardComponent implements OnInit {
@@ -23,10 +25,10 @@ export class DashboardComponent implements OnInit {
heroes: Hero[] = [];
// #docregion ctor
- constructor(
- private router: Router,
- private heroService: HeroService) {
+ constructor(private router: Router,
+ private heroService: HeroService) {
}
+
// #enddocregion ctor
ngOnInit() {
@@ -34,10 +36,8 @@ export class DashboardComponent implements OnInit {
.then(heroes => this.heroes = heroes.slice(1, 5));
}
+ // TODO Move in docs
// #docregion goto-detail
- gotoDetail(hero: Hero) {
- let link = ['/detail', hero.id];
- this.router.navigate(link);
- }
+ // ....
// #enddocregion goto-detail
}
diff --git a/public/docs/_examples/toh-5/ts/app/hero-detail.component.css b/public/docs/_examples/toh-5/ts/app/hero-detail.component.css
index ab2437efd8..3c4397608f 100644
--- a/public/docs/_examples/toh-5/ts/app/hero-detail.component.css
+++ b/public/docs/_examples/toh-5/ts/app/hero-detail.component.css
@@ -1,9 +1,8 @@
/* #docregion */
-label {
- display: inline-block;
+label,
+dt{
width: 3em;
- margin: .5em 0;
- color: #607D8B;
+ color: #4e6671;
font-weight: bold;
}
input {
@@ -20,11 +19,12 @@ button {
border-radius: 4px;
cursor: pointer; cursor: hand;
}
-button:hover {
+button:hover,
+button:focus {
background-color: #cfd8dc;
}
button:disabled {
background-color: #eee;
- color: #ccc;
+ color: #ccc;
cursor: auto;
}
diff --git a/public/docs/_examples/toh-5/ts/app/hero-detail.component.html b/public/docs/_examples/toh-5/ts/app/hero-detail.component.html
index cf96fc2169..c207886f07 100644
--- a/public/docs/_examples/toh-5/ts/app/hero-detail.component.html
+++ b/public/docs/_examples/toh-5/ts/app/hero-detail.component.html
@@ -2,13 +2,16 @@
\ No newline at end of file
+
diff --git a/public/docs/_examples/toh-5/ts/app/hero-detail.component.ts b/public/docs/_examples/toh-5/ts/app/hero-detail.component.ts
index 61edccb90e..685067fef2 100644
--- a/public/docs/_examples/toh-5/ts/app/hero-detail.component.ts
+++ b/public/docs/_examples/toh-5/ts/app/hero-detail.component.ts
@@ -7,6 +7,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// #enddocregion import-activated-route
+import { Router } from '@angular/router';
+
import { Hero } from './hero';
// #docregion import-hero-service
import { HeroService } from './hero.service';
@@ -27,12 +29,14 @@ export class HeroDetailComponent implements OnInit, OnDestroy {
// #enddocregion implement
hero: Hero;
sub: any;
+ redirect: any;
// #docregion ctor
- constructor(
- private heroService: HeroService,
- private route: ActivatedRoute) {
+ constructor(private heroService: HeroService,
+ private route: ActivatedRoute,
+ private router: Router) {
}
+
// #enddocregion ctor
// #docregion ng-oninit
@@ -44,18 +48,26 @@ export class HeroDetailComponent implements OnInit, OnDestroy {
.then(hero => this.hero = hero);
});
// #enddocregion get-id
+
}
+
// #enddocregion ng-oninit
// #docregion ng-ondestroy
ngOnDestroy() {
this.sub.unsubscribe();
}
+
// #enddocregion ng-ondestroy
// #docregion go-back
goBack() {
- window.history.back();
+ if (window.history.length > 1) {
+ window.history.back();
+ } else {
+ this.router.navigate(['/']);
+ }
}
+
// #enddocregion go-back
}
diff --git a/public/docs/_examples/toh-5/ts/app/heroes.component.css b/public/docs/_examples/toh-5/ts/app/heroes.component.css
index 35e45af98d..09cb219979 100644
--- a/public/docs/_examples/toh-5/ts/app/heroes.component.css
+++ b/public/docs/_examples/toh-5/ts/app/heroes.component.css
@@ -1,6 +1,6 @@
.selected {
background-color: #CFD8DC !important;
- color: white;
+ color: black;
}
.heroes {
margin: 0 0 2em 0;
@@ -8,24 +8,29 @@
padding: 0;
width: 15em;
}
-.heroes li {
+.heroes button {
cursor: pointer;
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
- padding: .3em 0;
- height: 1.6em;
+ /*padding: .3em 0;*/
+ /*height: 1.6em;*/
+ text-align: left;
+ width: 15em;
+ height: 2.7em;
border-radius: 4px;
}
-.heroes li:hover {
- color: #607D8B;
- background-color: #DDD;
- left: .1em;
-}
-.heroes li.selected:hover {
+.heroes button.selected:hover,
+.heroes button.selected:focus{
background-color: #BBD8DC !important;
+ color: black;
+}
+.heroes button:hover,
+.heroes button:focus{
color: white;
+ background-color: #6469dd;
+ left: 0.8em;
}
.heroes .text {
position: relative;
@@ -36,13 +41,13 @@
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
- background-color: #607D8B;
+ background-color: #4E6570;
line-height: 1em;
position: relative;
- left: -1px;
+ left: -8px;
top: -4px;
height: 1.8em;
- margin-right: .8em;
+ /*margin-right: .8em;*/
border-radius: 4px 0 0 4px;
}
button {
diff --git a/public/docs/_examples/toh-5/ts/app/heroes.component.html b/public/docs/_examples/toh-5/ts/app/heroes.component.html
index db41c4692e..5ff3602baa 100644
--- a/public/docs/_examples/toh-5/ts/app/heroes.component.html
+++ b/public/docs/_examples/toh-5/ts/app/heroes.component.html
@@ -2,10 +2,10 @@
-
-
-
-
diff --git a/public/docs/_examples/toh-6/ts/app/hero-detail.component.css b/public/docs/_examples/toh-6/ts/app/hero-detail.component.css
index ab2437efd8..3c4397608f 100644
--- a/public/docs/_examples/toh-6/ts/app/hero-detail.component.css
+++ b/public/docs/_examples/toh-6/ts/app/hero-detail.component.css
@@ -1,9 +1,8 @@
/* #docregion */
-label {
- display: inline-block;
+label,
+dt{
width: 3em;
- margin: .5em 0;
- color: #607D8B;
+ color: #4e6671;
font-weight: bold;
}
input {
@@ -20,11 +19,12 @@ button {
border-radius: 4px;
cursor: pointer; cursor: hand;
}
-button:hover {
+button:hover,
+button:focus {
background-color: #cfd8dc;
}
button:disabled {
background-color: #eee;
- color: #ccc;
+ color: #ccc;
cursor: auto;
}
diff --git a/public/docs/_examples/toh-6/ts/app/hero-detail.component.html b/public/docs/_examples/toh-6/ts/app/hero-detail.component.html
index 38af5f707e..c04f45bf58 100644
--- a/public/docs/_examples/toh-6/ts/app/hero-detail.component.html
+++ b/public/docs/_examples/toh-6/ts/app/hero-detail.component.html
@@ -2,12 +2,15 @@
{{hero.name}} details!
+
+ - id:
+ - {{hero.id}}
+
- {{hero.id}}
-
-
-
-
+
+
diff --git a/public/docs/_examples/toh-6/ts/app/heroes.component.css b/public/docs/_examples/toh-6/ts/app/heroes.component.css
index 35e45af98d..489aac644a 100644
--- a/public/docs/_examples/toh-6/ts/app/heroes.component.css
+++ b/public/docs/_examples/toh-6/ts/app/heroes.component.css
@@ -1,6 +1,6 @@
.selected {
background-color: #CFD8DC !important;
- color: white;
+ color: black;
}
.heroes {
margin: 0 0 2em 0;
@@ -18,14 +18,16 @@
height: 1.6em;
border-radius: 4px;
}
-.heroes li:hover {
- color: #607D8B;
- background-color: #DDD;
- left: .1em;
-}
-.heroes li.selected:hover {
+.heroes li.selected:hover,
+.heroes li.selected:focus{
background-color: #BBD8DC !important;
+ color: black;
+}
+.heroes li:hover,
+.heroes li:focus{
color: white;
+ background-color: #6469dd;
+ left: .1em;
}
.heroes .text {
position: relative;
@@ -36,7 +38,7 @@
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
- background-color: #607D8B;
+ background-color: #4E6570;
line-height: 1em;
position: relative;
left: -1px;
diff --git a/public/docs/_examples/toh-6/ts/app/heroes.component.html b/public/docs/_examples/toh-6/ts/app/heroes.component.html
index 05afc9ea2f..99c8f77265 100644
--- a/public/docs/_examples/toh-6/ts/app/heroes.component.html
+++ b/public/docs/_examples/toh-6/ts/app/heroes.component.html
@@ -1,7 +1,13 @@
My Heroes
- -
+
-
{{hero.id}} {{hero.name}}
diff --git a/public/docs/_examples/toh-6/ts/index.html b/public/docs/_examples/toh-6/ts/index.html
index b84f744a78..ed96e12ff1 100644
--- a/public/docs/_examples/toh-6/ts/index.html
+++ b/public/docs/_examples/toh-6/ts/index.html
@@ -1,5 +1,5 @@
-
+
Angular 2 Tour of Heroes
diff --git a/public/docs/_examples/toh-6/ts/sample.css b/public/docs/_examples/toh-6/ts/sample.css
index 0c99008d2d..4fb2cb317b 100644
--- a/public/docs/_examples/toh-6/ts/sample.css
+++ b/public/docs/_examples/toh-6/ts/sample.css
@@ -1,7 +1,16 @@
-/* #docregion */
-.error {color:red;}
+body, button{
+ color: #5E5E5E;
+}
+
+dt {
+ float: left;
+ clear: left;
+}
button.delete-button{
float:right;
- background-color: gray !important;
+ background-color: #5b5b5b !important;
color:white;
}
+
+
+