Mainly Dart-side review, following #1654: - Updates to follow style guide - Enabled e2e tests - Fixes to ensure tests pass: in after_view_component.dart and after_content_component.dart - Changed test over comment field in template to be: *ngIf="comment.isNotEmpty" - Suites passed: public/docs/_examples/lifecycle-hooks/dart public/docs/_examples/lifecycle-hooks/ts
24 lines
523 B
Dart
24 lines
523 B
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'logger_service.dart';
|
|
|
|
int _nextId = 1;
|
|
|
|
// #docregion spy-directive
|
|
// Spy on any element to which it is applied.
|
|
// Usage: <div mySpy>...</div>
|
|
@Directive(selector: '[mySpy]')
|
|
class SpyDirective implements OnInit, OnDestroy {
|
|
final LoggerService _logger;
|
|
|
|
SpyDirective(this._logger);
|
|
|
|
ngOnInit() => _logIt('onInit');
|
|
|
|
ngOnDestroy() => _logIt('onDestroy');
|
|
|
|
_logIt(String msg) => _logger.log('Spy #${_nextId++} $msg');
|
|
}
|
|
// #enddocregion spy-directive
|