Also update dart_to_js_script_rewriter dependency to ^1.0.1, and change most angular2.dart imports to be core.dart instead. The pipes example broke without the angular2.dart import, so I let it be. The server-communication sample has never worked for me, so I changed it but might have broken it further. closes #1007
23 lines
453 B
Dart
23 lines
453 B
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'logger_service.dart';
|
|
|
|
int nextId = 1;
|
|
|
|
// Spy on any element to which it is applied.
|
|
// Usage: <div mySpy>...</div>
|
|
@Directive(selector: '[mySpy]')
|
|
class Spy implements OnInit, OnDestroy {
|
|
int _id = nextId++;
|
|
LoggerService _logger;
|
|
|
|
Spy(this._logger);
|
|
|
|
ngOnInit() => _logIt('onInit');
|
|
|
|
ngOnDestroy() => _logIt('onDestroy');
|
|
|
|
_logIt(String msg) => _logger.log('Spy #$_id $msg');
|
|
}
|