* docs(template-syntax): refresh _cache * docs(template-syntax/dart): updates to match TS - Propagates TS-side changes: - update #2639 - new two-way binding section, and - fix #2687 - invalid attr syntax - Fixes - #1898 - currency symbols - #2748 - Dart template-syntax e2e is failing - #2749 - deprecated `[className]` * updated _cache file following Kathy's post-review edits * Post Ward's review w/ cache updated - Keep `my-` and `my` prefixes on selectors (for components and directives, respectively). - Drop `my-` from file names. - Drop `My` as component class prefix.
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
// #docplaster
 | 
						|
import 'dart:html';
 | 
						|
 | 
						|
import 'package:angular2/core.dart';
 | 
						|
 | 
						|
@Directive(selector: '[myClick]')
 | 
						|
class MyClickDirective {
 | 
						|
  // #docregion output-myClick
 | 
						|
  // @Output(alias) [type info] propertyName = ...
 | 
						|
  @Output('myClick') final EventEmitter clicks = new EventEmitter<String>();
 | 
						|
 | 
						|
  // #enddocregion output-myClick
 | 
						|
  bool _toggle = false;
 | 
						|
 | 
						|
  MyClickDirective(ElementRef el) {
 | 
						|
    Element nativeEl = el.nativeElement;
 | 
						|
    nativeEl.onClick.listen((Event e) {
 | 
						|
      _toggle = !_toggle;
 | 
						|
      clicks.emit(_toggle ? 'Click!' : '');
 | 
						|
    });
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
// #docregion output-myClick2
 | 
						|
@Directive(
 | 
						|
// #enddocregion output-myClick2
 | 
						|
    selector: '[myClick2]',
 | 
						|
// #docregion output-myClick2
 | 
						|
    // ...
 | 
						|
    outputs: const ['clicks:myClick']) // propertyName:alias
 | 
						|
// #enddocregion output-myClick2
 | 
						|
class MyClickDirective2 {
 | 
						|
  final EventEmitter clicks = new EventEmitter<String>();
 | 
						|
  bool _toggle = false;
 | 
						|
 | 
						|
  MyClickDirective2(ElementRef el) {
 | 
						|
    el.nativeElement.onClick.listen((Event e) {
 | 
						|
      _toggle = !_toggle;
 | 
						|
      clicks.emit(_toggle ? 'Click2!' : '');
 | 
						|
    });
 | 
						|
  }
 | 
						|
}
 |