Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(guide/lifecycle-hooks): follow-up to #1654 #1768

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ChildComponent {
<div>-- projected content begins --</div>
<ng-content></ng-content>
<div>-- projected content ends --</div>
<p *ngIf="comment != null" class="comment">{{comment}}</p>
<p *ngIf="comment.isNotEmpty" class="comment">{{comment}}</p>
Copy link
Contributor

@kwalrath kwalrath Jun 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the . be ?.?
Actually, I guess ?. doesn't return a boolean. But should we do a null check?

'''
// #enddocregion template
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class ChildViewComponent {
<div>-- child view begins --</div>
<my-child></my-child>
<div>-- child view ends --</div>
<p *ngIf="comment != null" class="comment">{{comment}}</p>''',
<p *ngIf="comment.isNotEmpty" class="comment">{{comment}}</p>''',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to lose the null check?

// #enddocregion template
directives: const [ChildViewComponent])
// #docregion hooks
class AfterViewComponent implements AfterViewChecked, AfterViewInit {
var _prevHero = '';

// Query for a VIEW child of type `ChildViewComponent`
@ViewChild(ChildViewComponent) ChildViewComponent viewChild;

// #enddocregion hooks
final LoggerService _logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import 'spy_directive.dart';
styles: const [
'.counter {background: LightYellow; padding: 8px; margin-top: 8px}'
],
directives: const [Spy])
class MyCounter implements OnChanges {
directives: const [SpyDirective])
class MyCounterComponent implements OnChanges {
@Input() num counter;
List<String> changeLog = [];

Expand Down Expand Up @@ -53,7 +53,7 @@ class MyCounter implements OnChanges {
</div>
''',
styles: const ['.parent {background: gold;}'],
directives: const [MyCounter],
directives: const [MyCounterComponent],
providers: const [LoggerService])
class CounterParentComponent {
final LoggerService _logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'spy_directive.dart';
'.parent {background: khaki}',
'.heroes {background: LightYellow; padding: 0 8px}'
],
directives: const [Spy],
directives: const [SpyDirective],
providers: const [LoggerService])
class SpyParentComponent {
final LoggerService _logger;
Expand All @@ -31,7 +31,7 @@ class SpyParentComponent {
}

// removeHero(String hero) { } is not used.

void reset() {
_logger.log('-- reset --');
heroes.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ int _nextId = 1;
// Spy on any element to which it is applied.
// Usage: <div mySpy>...</div>
@Directive(selector: '[mySpy]')
class Spy implements OnInit, OnDestroy {
class SpyDirective implements OnInit, OnDestroy {
final LoggerService _logger;

Spy(this._logger);
SpyDirective(this._logger);

ngOnInit() => _logIt('onInit');

Expand Down