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
33 lines
630 B
Dart
33 lines
630 B
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
@Directive(selector: '[my-highlight]',
|
|
// #docregion host
|
|
host: const {
|
|
'(mouseenter)': 'onMouseEnter()',
|
|
'(mouseleave)': 'onMouseLeave()'
|
|
}
|
|
// #enddocregion host
|
|
)
|
|
class Highlight {
|
|
final ElementRef _element;
|
|
// #docregion mouse-methods
|
|
onMouseEnter() {
|
|
_highlight("yellow");
|
|
}
|
|
|
|
onMouseLeave() {
|
|
_highlight(null);
|
|
}
|
|
// #enddocregion mouse-methods
|
|
|
|
void _highlight(String color) {
|
|
_element.nativeElement.style.backgroundColor = color;
|
|
}
|
|
|
|
// #docregion ctor
|
|
Highlight(this._element);
|
|
// #enddocregion ctor
|
|
}
|
|
// #enddocregion
|