docs(guide/user-input): follow-up to #1654 (#1770)

Mainly Dart-side review, following #1654:
- Updates to follow style guide
- Suites passed:
  public/docs/_examples/user-input/dart
  public/docs/_examples/user-input/ts

Note: the click-me2 component is not mentioned in the prose, maybe it
should be.
This commit is contained in:
Patrice Chalin 2016-06-28 08:25:12 -07:00 committed by Kathy Walrath
parent 3510f96620
commit 283195685f
4 changed files with 29 additions and 25 deletions

View File

@ -2,7 +2,7 @@
import 'package:angular2/core.dart';
import 'click_me_component.dart';
import 'click_me_component_2.dart';
import 'click_me2_component.dart';
import 'keyup_components.dart';
import 'little_tour_component.dart';
import 'loop_back_component.dart';
@ -12,7 +12,7 @@ import 'loop_back_component.dart';
templateUrl: 'app_component.html',
directives: const [
ClickMeComponent,
ClickMeComponent2,
ClickMe2Component,
KeyUpComponentV1,
KeyUpComponentV2,
KeyUpComponentV3,

View File

@ -0,0 +1,18 @@
// #docregion
import 'package:angular2/core.dart';
@Component(
selector: 'click-me2',
template: '''
<button (click)="onClickMe2(\$event)">No! .. Click me!</button>
{{clickMessage}}''')
class ClickMe2Component {
String clickMessage = '';
int _clicks = 1;
void onClickMe2(dynamic event) {
var evtMsg =
event != null ? ' Event target is ' + event.target.tagName : '';
clickMessage = ('Click #${_clicks++}. ${evtMsg}');
}
}

View File

@ -1,3 +1,9 @@
/* FOR DOCS ... MUST MATCH ClickMeComponent template
// #docregion click-me-button
<button (click)="onClickMe()">Click me!</button>
// #enddocregion click-me-button
*/
// #docregion
import 'package:angular2/core.dart';
@ -5,15 +11,12 @@ import 'package:angular2/core.dart';
@Component(
selector: 'click-me',
template: '''
// #docregion click-me-button
<button (click)="onClickMe()">Click me!</button>
// #enddocregion click-me-button
{{clickMessage}}''')
<button (click)="onClickMe()">Click me!</button>
{{clickMessage}}''')
class ClickMeComponent {
String clickMessage = '';
onClickMe() {
void onClickMe() {
clickMessage = 'You are my hero!';
}
}
// #enddocregion click-me-component

View File

@ -1,17 +0,0 @@
// #docregion
import 'package:angular2/core.dart';
@Component(
selector: 'click-me2',
template: '''<button (click)="onClickMe2(\$event)">No! .. Click me!</button>
{{clickMessage}}''')
class ClickMeComponent2 {
String clickMessage = '';
int clicks = 1;
onClickMe2(dynamic event) {
var evtMsg =
event != null ? ' Event target is ' + event.target.tagName : '';
clickMessage = ('Click #${clicks++}. ${evtMsg}');
}
}