Skip to content

Commit 9e18569

Browse files
committed
9bdd595 docs(forms): update the docs to reflect the current behavior
1 parent 00b4107 commit 9e18569

18 files changed

Lines changed: 242 additions & 127 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:10:53 UTC 2016
2-
9daf2aa2155dd9b990736ac5a7427515cd5b9462
1+
Mon Mar 28 17:39:47 UTC 2016
2+
9bdd5951d946940bc5ddfed8995a77f93d1f0b3f

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

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

bundles/angular2-all.umd.dev.js

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

bundles/angular2-all.umd.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19831,9 +19831,10 @@ 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 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.
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.
1983719838
*
1983819839
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular,
1983919840
* along with {@link Control} and {@link ControlArray}. {@link ControlArray} can also contain other
@@ -19931,9 +19932,10 @@ return /******/ (function(modules) { // webpackBootstrap
1993119932
/**
1993219933
* Defines a part of a form, of variable length, that can contain other controls.
1993319934
*
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.
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.
1993719939
*
1993819940
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular,
1993919941
* 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: 13 additions & 26 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: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 9 additions & 7 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: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,38 @@ 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 ChildCmp = class {
15-
};
16-
ChildCmp = __decorate([
17-
Component({ template: `Child` }),
18-
__metadata('design:paramtypes', [])
19-
], ChildCmp);
20-
let ParentCmp = class {
14+
let MyCmp = class {
2115
constructor() {
2216
this.log = '';
2317
}
2418
routerOnActivate(next, prev) {
2519
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-
});
3020
}
3121
};
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 }]),
22+
MyCmp = __decorate([
23+
Component({ selector: 'my-cmp', template: `<div>routerOnActivate: {{log}}</div>` }),
4024
__metadata('design:paramtypes', [])
41-
], ParentCmp);
25+
], MyCmp);
4226
// #enddocregion
43-
export let AppCmp = class {
27+
let AppCmp = class {
4428
};
4529
AppCmp = __decorate([
4630
Component({
4731
selector: 'example-app',
4832
template: `
49-
<h1>My app</h1>
50-
33+
<h1>My App</h1>
5134
<nav>
52-
<a [routerLink]="['Parent', 'Child']">Child</a>
35+
<a [routerLink]="['/HomeCmp']" id="home-link">Navigate Home</a> |
36+
<a [routerLink]="['/ParamCmp', {param: 1}]" id="param-link">Navigate with a Param</a>
5337
</nav>
5438
<router-outlet></router-outlet>
5539
`,
5640
directives: [ROUTER_DIRECTIVES]
5741
}),
58-
RouteConfig([{ path: '/parent/...', name: 'Parent', component: ParentCmp }]),
42+
RouteConfig([
43+
{ path: '/', component: MyCmp, name: 'HomeCmp' },
44+
{ path: '/:param', component: MyCmp, name: 'ParamCmp' }
45+
]),
5946
__metadata('design:paramtypes', [])
6047
], AppCmp);
6148
export function main() {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { verifyNoBrowserErrors, browser } from 'angular2/src/testing/e2e_util';
2+
import { expect } from 'angular2/testing';
3+
function waitForElement(selector) {
4+
var EC = protractor.ExpectedConditions;
5+
// Waits for the element with id 'abc' to be present on the dom.
6+
browser.wait(EC.presenceOf($(selector)), 20000);
7+
}
8+
describe('on activate example app', function () {
9+
afterEach(verifyNoBrowserErrors);
10+
var URL = 'angular2/examples/router/ts/on_activate/';
11+
it('should update the text when navigating between routes', function () {
12+
browser.get(URL);
13+
waitForElement('my-cmp');
14+
expect(element(by.css('my-cmp')).getText())
15+
.toContain('routerOnActivate: Finished navigating from "null" to ""');
16+
element(by.css('#param-link')).click();
17+
waitForElement('my-cmp');
18+
expect(element(by.css('my-cmp')).getText())
19+
.toContain('routerOnActivate: Finished navigating from "" to "1"');
20+
browser.navigate().back();
21+
waitForElement('my-cmp');
22+
expect(element(by.css('my-cmp')).getText())
23+
.toContain('routerOnActivate: Finished navigating from "1" to ""');
24+
});
25+
});

0 commit comments

Comments
 (0)