Skip to content

Commit f3f45fa

Browse files
committed
docs(lifecycle-hooks): post-RC5 Dart resync
- TS prose: removed mention of `routerOnActivate` which no longer exists in the new router. - TS improvements to the sample code have also been propagated to the Dart sample. Contributes to angular#2077. E2E tests pass now.
1 parent d9b899e commit f3f45fa

File tree

10 files changed

+245
-223
lines changed

10 files changed

+245
-223
lines changed

public/docs/_examples/lifecycle-hooks/dart/lib/after_view_component.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'logger_service.dart';
77
//////////////////
88
// #docregion child-view
99
@Component(
10-
selector: 'my-child',
10+
selector: 'my-child-view',
1111
template: '<input [(ngModel)]="hero">')
1212
class ChildViewComponent {
1313
String hero = 'Magneta';
@@ -20,7 +20,7 @@ class ChildViewComponent {
2020
// #docregion template
2121
template: '''
2222
<div>-- child view begins --</div>
23-
<my-child></my-child>
23+
<my-child-view></my-child-view>
2424
<div>-- child view ends --</div>
2525
<p *ngIf="comment.isNotEmpty" class="comment">{{comment}}</p>''',
2626
// #enddocregion template

public/docs/_examples/lifecycle-hooks/dart/lib/do_check_component.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class DoCheckComponent implements DoCheck, OnChanges {
9292

9393
@Component(
9494
selector: 'do-check-parent',
95-
templateUrl: 'on_changes_parent_component.html',
95+
templateUrl: 'do_check_parent_component.html',
9696
styles: const ['.parent {background: Lavender}'],
9797
directives: const [DoCheckComponent])
9898
class DoCheckParentComponent {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div class="parent">
2+
<h2>{{title}}</h2>
3+
4+
<table>
5+
<tr><td>Power: </td><td><input [(ngModel)]="power"></td></tr>
6+
<tr><td>Hero.name: </td><td><input [(ngModel)]="hero.name"></td></tr>
7+
</table>
8+
<p><button (click)="reset()">Reset Log</button></p>
9+
10+
<!-- #docregion do-check -->
11+
<do-check [hero]="hero" [power]="power"></do-check>
12+
<!-- #enddocregion do-check -->
13+
</div>

public/docs/_examples/lifecycle-hooks/dart/lib/on_changes_parent_component.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ <h2>{{title}}</h2>
77
</table>
88
<p><button (click)="reset()">Reset Log</button></p>
99

10-
<!-- #docregion on-changes -->
10+
<!-- #docregion on-changes -->
1111
<on-changes [hero]="hero" [power]="power"></on-changes>
12-
<!-- #enddocregion on-changes -->
13-
<do-check [hero]="hero" [power]="power"></do-check>
12+
<!-- #enddocregion on-changes -->
1413
</div>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// #docregion
21
import 'package:angular2/platform/browser.dart';
3-
42
import 'package:lifecycle_hooks/app_component.dart';
53

6-
main() {
4+
void main() {
75
bootstrap(AppComponent);
86
}

public/docs/_examples/lifecycle-hooks/ts/app/main.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// #docregion
21
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
32
import { AppModule } from './app.module';
43

public/docs/_examples/lifecycle-hooks/ts/app/on-changes-parent.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h2>{{title}}</h2>
77
</table>
88
<p><button (click)="reset()">Reset Log</button></p>
99

10-
<!-- #docregion on-changes -->
10+
<!-- #docregion on-changes -->
1111
<on-changes [hero]="hero" [power]="power"></on-changes>
12-
<!-- #enddocregion on-changes -->
12+
<!-- #enddocregion on-changes -->
1313
</div>

public/docs/dart/latest/guide/lifecycle-hooks.jade

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ extends ../../../ts/_cache/guide/lifecycle-hooks.jade
33
block includes
44
include ../_util-fns
55

6-
block optional-interfaces
7-
//- n/a for Dart
6+
block other-angular-subsystems
7+
:marked
8+
The router, for instance, also has it's own [router lifecycle
9+
hooks](router.html#router-lifecycle-hooks) that allow us to tap into
10+
specific moments in route navigation.
11+
A parallel can be drawn between `ngOnInit` and `routerOnActivate`. Both are
12+
prefixed so as to avoid collision, and both run right when a component is
13+
'booting' up.
814

915
block tick-methods
1016
:marked
11-
The `LoggerService.tick` method, which returns a `Future`, postpones the update one turn of the of the browser's update cycle ... and that's long enough.
17+
The `LoggerService.tick` method, which returns a `Future`, postpones the
18+
update one turn of the of the browser's update cycle ... and that's long enough.

0 commit comments

Comments
 (0)