Skip to content

Commit 4e73185

Browse files
brandonrobertsnaomiblack
authored andcommitted
docs(router): Updated docs to reflect alpha 7 release
1 parent 42e8c4a commit 4e73185

18 files changed

+143
-115
lines changed

public/docs/_examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@angular/http": "2.0.0-rc.2",
3232
"@angular/platform-browser": "2.0.0-rc.2",
3333
"@angular/platform-browser-dynamic": "2.0.0-rc.2",
34-
"@angular/router": "2.0.0-rc.2",
34+
"@angular/router": "3.0.0-alpha.7",
3535
"@angular/router-deprecated": "2.0.0-rc.2",
3636
"@angular/upgrade": "2.0.0-rc.2",
3737
"angular2-in-memory-web-api": "0.0.12",

public/docs/_examples/router/e2e-spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ describe('Router', function () {
2424
heroDetail: element(by.css('my-app > undefined > div')),
2525
heroDetailTitle: element(by.css('my-app > undefined > div > h3')),
2626

27+
adminHref: hrefEles.get(2),
28+
loginHref: hrefEles.get(3)
2729
};
2830
}
2931

3032
it('should be able to see the start screen', function () {
3133
let page = getPageStruct();
32-
expect(page.hrefs.count()).toEqual(2, 'should be two dashboard choices');
34+
expect(page.hrefs.count()).toEqual(4, 'should be two dashboard choices');
3335
expect(page.crisisHref.getText()).toEqual('Crisis Center');
3436
expect(page.heroesHref.getText()).toEqual('Heroes');
37+
expect(page.adminHref.getText()).toEqual('Crisis Admin');
38+
expect(page.loginHref.getText()).toEqual('Login');
3539
});
3640

3741
it('should be able to see crises center items', function () {

public/docs/_examples/router/ts/app/app.component.2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// #docregion
55
import { Component } from '@angular/core';
6-
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
6+
import { ROUTER_DIRECTIVES } from '@angular/router';
77

88
// #enddocregion
99
/*

public/docs/_examples/router/ts/app/app.routes.1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import { HeroDetailComponent } from './heroes/hero-detail.component';
1616
// #docregion route-config
1717
export const routes: RouterConfig = [
1818
// #docregion route-defs
19-
{ path: '/crisis-center', component: CrisisCenterComponent },
20-
{ path: '/heroes', component: HeroListComponent },
19+
{ path: 'crisis-center', component: CrisisCenterComponent },
20+
{ path: 'heroes', component: HeroListComponent },
2121
// #enddocregion route-defs
2222
// #docregion hero-detail-route
23-
{ path: '/hero/:id', component: HeroDetailComponent }
23+
{ path: 'hero/:id', component: HeroDetailComponent }
2424
// #enddocregion hero-detail-route
2525
];
2626

public/docs/_examples/router/ts/app/app.routes.2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { HeroListComponent } from './hero-list.component';
99

1010
// #docregion route-config
1111
export const routes: RouterConfig = [
12-
{ path: '/crisis-center', component: CrisisListComponent },
13-
{ path: '/heroes', component: HeroListComponent }
12+
{ path: 'crisis-center', component: CrisisListComponent },
13+
{ path: 'heroes', component: HeroListComponent }
1414
];
1515

1616
export const APP_ROUTER_PROVIDERS = [

public/docs/_examples/router/ts/app/app.routes.3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { HeroesRoutes } from './heroes/heroes.routes';
77

88
export const routes = [
99
...HeroesRoutes,
10-
{ path: '/crisis-center', component: CrisisListComponent }
10+
{ path: 'crisis-center', component: CrisisListComponent }
1111
];
1212

1313
export const APP_ROUTER_PROVIDERS = [

public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { CrisisCenterComponent } from './crisis-center.component';
77
// #docregion routes
88
export const CrisisCenterRoutes: RouterConfig = [
99
{
10-
path: '/crisis-center',
10+
path: 'crisis-center',
1111
component: CrisisCenterComponent,
1212
children: [
13-
{ path: '/', component: CrisisListComponent },
14-
{ path: '/:id', component: CrisisDetailComponent }
13+
{ path: ':id', component: CrisisDetailComponent },
14+
{ path: '', component: CrisisListComponent }
1515
]
1616
}
1717
];

public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.2.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ import { CrisisCenterComponent } from './crisis-center.component';
66

77
// #docregion routes
88
export const CrisisCenterRoutes: RouterConfig = [
9+
// #docregion redirect
910
{
10-
path: '/crisis-center',
11+
path: '',
12+
redirectTo: '/crisis-center',
13+
terminal: true
14+
},
15+
// #enddocregion redirect
16+
{
17+
path: 'crisis-center',
1118
component: CrisisCenterComponent,
12-
index: true,
1319
children: [
14-
{ path: '/:id', component: CrisisDetailComponent },
15-
{ path: '/', component: CrisisListComponent,
16-
index: true
17-
}
20+
{ path: ':id', component: CrisisDetailComponent },
21+
{ path: '', component: CrisisListComponent }
1822
]
1923
}
2024
];
2125
// #enddocregion routes
22-

public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.3.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,28 @@ import { CanDeactivateGuard } from '../interfaces';
1010

1111
export const CrisisCenterRoutes: RouterConfig = [
1212
{
13-
path: '/crisis-center',
13+
path: '',
14+
redirectTo: '/crisis-center',
15+
terminal: true
16+
},
17+
{
18+
path: 'crisis-center',
1419
component: CrisisCenterComponent,
15-
index: true,
1620
children: [
1721
// #docregion admin-route-no-guard
1822
{
19-
path: '/admin',
23+
path: 'admin',
2024
component: CrisisAdminComponent
2125
},
2226
// #enddocregion admin-route-no-guard
2327
{
24-
path: '/:id',
28+
path: ':id',
2529
component: CrisisDetailComponent,
2630
canDeactivate: [CanDeactivateGuard]
2731
},
2832
{
29-
path: '/',
30-
component: CrisisListComponent,
31-
index: true
33+
path: '',
34+
component: CrisisListComponent
3235
}
3336
]
3437
}
@@ -40,7 +43,7 @@ export const CrisisCenterRoutes: RouterConfig = [
4043
import { AuthGuard } from '../auth.guard';
4144
4245
{
43-
path: '/admin',
46+
path: 'admin',
4447
component: CrisisAdminComponent,
4548
canActivate: [AuthGuard]
4649
}

public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.4.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,28 @@ import { AuthGuard } from '../auth.guard';
1111

1212
export const CrisisCenterRoutes: RouterConfig = [
1313
{
14-
path: '/crisis-center',
14+
path: '',
15+
redirectTo: '/crisis-center',
16+
terminal: true
17+
},
18+
{
19+
path: 'crisis-center',
1520
component: CrisisCenterComponent,
16-
index: true,
1721
children: [
1822
{
19-
path: '/admin',
23+
path: 'admin',
2024
component: CrisisAdminComponent,
2125
canActivate: [AuthGuard]
2226
},
2327
{
24-
path: '/:id',
28+
path: ':id',
2529
component: CrisisDetailComponent,
2630
canDeactivate: [CanDeactivateGuard]
2731
},
2832
// #docregion default-route
2933
{
30-
path: '/',
31-
component: CrisisListComponent,
32-
index: true
34+
path: '',
35+
component: CrisisListComponent
3336
}
3437
// #enddocregion default-route
3538
]
@@ -42,7 +45,7 @@ export const CrisisCenterRoutes: RouterConfig = [
4245
import { AuthGuard } from '../auth.guard';
4346
4447
{
45-
path: '/admin',
48+
path: 'admin',
4649
component: CrisisAdminComponent,
4750
canActivate: [AuthGuard]
4851
}

public/docs/_examples/router/ts/app/crisis-center/crisis-center.routes.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@ import { AuthGuard } from '../auth.guard';
1010

1111
export const CrisisCenterRoutes: RouterConfig = [
1212
{
13-
path: '/crisis-center',
13+
path: '',
14+
redirectTo: '/crisis-center',
15+
terminal: true
16+
},
17+
{
18+
path: 'crisis-center',
1419
component: CrisisCenterComponent,
15-
index: true,
1620
children: [
1721
// #docregion admin-route
1822
{
19-
path: '/admin',
23+
path: 'admin',
2024
component: CrisisAdminComponent,
2125
canActivate: [AuthGuard]
2226
},
2327
// #enddocregion admin-route
2428
{
25-
path: '/:id',
29+
path: ':id',
2630
component: CrisisDetailComponent,
2731
canDeactivate: [CanDeactivateGuard]
2832
},
29-
{ path: '/',
30-
component: CrisisListComponent,
31-
index: true
33+
{
34+
path: '',
35+
component: CrisisListComponent
3236
}
3337
]
3438
}

public/docs/_examples/router/ts/app/crisis-center/crisis.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CRISES = [
1414
let crisesPromise = Promise.resolve(CRISES);
1515

1616
// #docregion
17-
import {Injectable} from '@angular/core';
17+
import { Injectable } from '@angular/core';
1818

1919
@Injectable()
2020
export class CrisisService {

public/docs/_examples/router/ts/app/heroes/hero-detail.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class HeroDetailComponent implements OnInit, OnDestroy {
5656
let heroId = this.hero ? this.hero.id : null;
5757
// Pass along the hero id if available
5858
// so that the HeroList component can select that hero.
59-
this.router.navigate(['/heroes'], { queryParams: { id: `${heroId}`, foo: 'foo' } });
59+
this.router.navigate(['/heroes'], { queryParams: { id: heroId, foo: 'foo' } });
6060
}
6161
// #enddocregion gotoHeroes-navigate
6262
}

public/docs/_examples/router/ts/app/heroes/heroes.routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { HeroListComponent } from './hero-list.component';
44
import { HeroDetailComponent } from './hero-detail.component';
55

66
export const HeroesRoutes: RouterConfig = [
7-
{ path: '/heroes', component: HeroListComponent },
7+
{ path: 'heroes', component: HeroListComponent },
88
// #docregion hero-detail-route
9-
{ path: '/hero/:id', component: HeroDetailComponent }
9+
{ path: 'hero/:id', component: HeroDetailComponent }
1010
// #enddocregion hero-detail-route
1111
];
1212
// #enddocregion

public/docs/_examples/router/ts/app/login.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Router } from '@angular/router';
44
import { AuthService } from './auth.service';
55

66
@Component({
7-
selector: 'login',
87
template: `
98
<h2>LOGIN</h2>
109
<p>{{message}}</p>
@@ -25,7 +24,7 @@ export class LoginComponent {
2524
}
2625

2726
login() {
28-
this.message = "Trying to log in ...";
27+
this.message = 'Trying to log in ...';
2928

3029
this.authService.login().subscribe(() => {
3130
this.setMessage();

public/docs/_examples/router/ts/app/login.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AuthService } from './auth.service';
44
import { LoginComponent } from './login.component';
55

66
export const LoginRoutes = [
7-
{ path: '/login', component: LoginComponent }
7+
{ path: 'login', component: LoginComponent }
88
];
99

1010
export const AUTH_PROVIDERS = [AuthGuard, AuthService];

public/docs/_examples/systemjs.config.plunker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(function(global) {
77

88
var ngVer = '@2.0.0-rc.2'; // lock in the angular package version; do not let it float to current!
9-
var routerVer = '@3.0.0-alpha.3'; // lock router version
9+
var routerVer = '@3.0.0-alpha.7'; // lock router version
1010

1111
//map tells the System loader where to look for things
1212
var map = {

0 commit comments

Comments
 (0)