Skip to content

Commit 00b4107

Browse files
committed
9daf2aa doc(Router): improve the example for routerOnActivate
1 parent c1b0eaf commit 00b4107

18 files changed

Lines changed: 127 additions & 242 deletions

File tree

BUILD_INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Mon Mar 28 17:09:57 UTC 2016
2-
6c8f96cea58f479cd5d1142df1556200c05691b4
1+
Mon Mar 28 17:10:53 UTC 2016
2+
9daf2aa2155dd9b990736ac5a7427515cd5b9462

bundles/angular2-all-testing.umd.dev.js

Lines changed: 7 additions & 9 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.dev.js

Lines changed: 7 additions & 9 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19831,10 +19831,9 @@ return /******/ (function(modules) { // webpackBootstrap
1983119831
/**
1983219832
* Defines a part of a form, of fixed length, that can contain other controls.
1983319833
*
19834-
* A `ControlGroup` aggregates the values of each {@link Control} in the group.
19835-
* The status of a `ControlGroup` depends on the status of its children.
19836-
* If one of the controls in a group is invalid, the entire group is invalid.
19837-
* Similarly, if a control changes its value, the entire group changes as well.
19834+
* A `ControlGroup` aggregates the values and errors of each {@link Control} in the group. Thus, if
19835+
* one of the controls in a group is invalid, the entire group is invalid. Similarly, if a control
19836+
* changes its value, the entire group changes as well.
1983819837
*
1983919838
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular,
1984019839
* along with {@link Control} and {@link ControlArray}. {@link ControlArray} can also contain other
@@ -19932,10 +19931,9 @@ return /******/ (function(modules) { // webpackBootstrap
1993219931
/**
1993319932
* Defines a part of a form, of variable length, that can contain other controls.
1993419933
*
19935-
* A `ControlArray` aggregates the values of each {@link Control} in the group.
19936-
* The status of a `ControlArray` depends on the status of its children.
19937-
* If one of the controls in a group is invalid, the entire array is invalid.
19938-
* Similarly, if a control changes its value, the entire array changes as well.
19934+
* A `ControlArray` aggregates the values and errors of each {@link Control} in the group. Thus, if
19935+
* one of the controls in a group is invalid, the entire group is invalid. Similarly, if a control
19936+
* changes its value, the entire group changes as well.
1993919937
*
1994019938
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular,
1994119939
* along with {@link Control} and {@link ControlGroup}. {@link ControlGroup} can also contain

es6/dev/examples/router/ts/on_activate/on_activate_example.js

Lines changed: 26 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

es6/dev/examples/router/ts/on_activate/on_activate_spec.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

es6/dev/src/common/forms/model.js

Lines changed: 7 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

es6/prod/examples/router/ts/on_activate/on_activate_example.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,51 @@ import { Component, provide } from 'angular2/core';
1111
import { bootstrap } from 'angular2/platform/browser';
1212
import { RouteConfig, ROUTER_DIRECTIVES, APP_BASE_HREF } from 'angular2/router';
1313
// #docregion routerOnActivate
14-
let MyCmp = class {
14+
let ChildCmp = class {
15+
};
16+
ChildCmp = __decorate([
17+
Component({ template: `Child` }),
18+
__metadata('design:paramtypes', [])
19+
], ChildCmp);
20+
let ParentCmp = class {
1521
constructor() {
1622
this.log = '';
1723
}
1824
routerOnActivate(next, prev) {
1925
this.log = `Finished navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`;
26+
return new Promise(resolve => {
27+
// The ChildCmp gets instantiated only when the Promise is resolved
28+
setTimeout(() => resolve(null), 1000);
29+
});
2030
}
2131
};
22-
MyCmp = __decorate([
23-
Component({ selector: 'my-cmp', template: `<div>routerOnActivate: {{log}}</div>` }),
32+
ParentCmp = __decorate([
33+
Component({
34+
template: `
35+
<h2>Parent</h2> (<router-outlet></router-outlet>)
36+
<p>{{log}}</p>`,
37+
directives: [ROUTER_DIRECTIVES]
38+
}),
39+
RouteConfig([{ path: '/child', name: 'Child', component: ChildCmp }]),
2440
__metadata('design:paramtypes', [])
25-
], MyCmp);
41+
], ParentCmp);
2642
// #enddocregion
27-
let AppCmp = class {
43+
export let AppCmp = class {
2844
};
2945
AppCmp = __decorate([
3046
Component({
3147
selector: 'example-app',
3248
template: `
33-
<h1>My App</h1>
49+
<h1>My app</h1>
50+
3451
<nav>
35-
<a [routerLink]="['/HomeCmp']" id="home-link">Navigate Home</a> |
36-
<a [routerLink]="['/ParamCmp', {param: 1}]" id="param-link">Navigate with a Param</a>
52+
<a [routerLink]="['Parent', 'Child']">Child</a>
3753
</nav>
3854
<router-outlet></router-outlet>
3955
`,
4056
directives: [ROUTER_DIRECTIVES]
4157
}),
42-
RouteConfig([
43-
{ path: '/', component: MyCmp, name: 'HomeCmp' },
44-
{ path: '/:param', component: MyCmp, name: 'ParamCmp' }
45-
]),
58+
RouteConfig([{ path: '/parent/...', name: 'Parent', component: ParentCmp }]),
4659
__metadata('design:paramtypes', [])
4760
], AppCmp);
4861
export function main() {

es6/prod/examples/router/ts/on_activate/on_activate_spec.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)