Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 917c51d

Browse files
committed
Ward's post-review updates
- Keep `my-` and `my` prefixes on selectors (for components and directives respectively). - Drop `my-` from file names. - Drop `My` as component class prefix.
1 parent a934ede commit 917c51d

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

public/docs/_examples/template-syntax/ts/app/app.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ <h3>
305305

306306
<div>
307307
<!-- #docregion event-binding-3 -->
308-
<!-- `myClick` is an event on the custom `MyClickDirective` -->
308+
<!-- `myClick` is an event on the custom `ClickDirective` -->
309309
<!-- #docregion my-click -->
310310
<div (myClick)="clickMessage=$event">click with myClick</div>
311311
<!-- #enddocregion my-click -->

public/docs/_examples/template-syntax/ts/app/app.module.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { FormsModule } from '@angular/forms';
44

55
import { AppComponent } from './app.component';
66
import { BigHeroDetailComponent, HeroDetailComponent } from './hero-detail.component';
7-
import { MyClickDirective, MyClickDirective2 } from './my-click.directive';
8-
import { MySizerComponent } from './my-sizer.component';
7+
import { ClickDirective, ClickDirective2 } from './click.directive';
8+
import { SizerComponent } from './sizer.component';
99

1010
@NgModule({
1111
imports: [
@@ -16,9 +16,9 @@ import { MySizerComponent } from './my-sizer.component';
1616
AppComponent,
1717
BigHeroDetailComponent,
1818
HeroDetailComponent,
19-
MyClickDirective,
20-
MyClickDirective2,
21-
MySizerComponent
19+
ClickDirective,
20+
ClickDirective2,
21+
SizerComponent
2222
],
2323
bootstrap: [ AppComponent ]
2424
})

public/docs/_examples/template-syntax/ts/app/my-click.directive.ts renamed to public/docs/_examples/template-syntax/ts/app/click.directive.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Directive, ElementRef, EventEmitter, Output } from '@angular/core';
44

55
@Directive({selector: '[myClick]'})
6-
export class MyClickDirective {
6+
export class ClickDirective {
77
// #docregion my-click-output-1
88
@Output('myClick') clicks = new EventEmitter<string>(); // @Output(alias) propertyName = ...
99
// #enddocregion my-click-output-1
@@ -27,7 +27,7 @@ export class MyClickDirective {
2727
outputs: ['clicks:myClick'] // propertyName:alias
2828
})
2929
// #enddocregion my-click-output-2
30-
export class MyClickDirective2 {
30+
export class ClickDirective2 {
3131
clicks = new EventEmitter<string>();
3232
toggle = false;
3333

public/docs/_examples/template-syntax/ts/app/my-sizer.component.ts renamed to public/docs/_examples/template-syntax/ts/app/sizer.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
1010
<label [style.font-size.px]="size">FontSize: {{size}}px</label>
1111
</div>`
1212
})
13-
export class MySizerComponent {
13+
export class SizerComponent {
1414
@Input() size: number | string;
1515
@Output() sizeChange = new EventEmitter<number>();
1616

public/docs/ts/latest/guide/template-syntax.jade

+6-6
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ block style-property-name-dart-diff
775775

776776
<a id="eventemitter"></a>
777777
<a id="custom-event"></a>
778-
### Custom events with EventEmitter
778+
### Custom events with *EventEmitter*
779779

780780
Directives typically raise custom events with an Angular [EventEmitter](../api/core/index/EventEmitter-class.html).
781781
The directive creates an `EventEmitter` and exposes it as a property.
@@ -860,7 +860,7 @@ block style-property-name-dart-diff
860860
:marked
861861
The `[(x)]` syntax is easy to demonstrate when the element has a settable property called `x`
862862
and a corresponding event named `xChange`.
863-
Here's a `MySizerComponent` that fits the pattern.
863+
Here's a `SizerComponent` that fits the pattern.
864864
It has a `size` value property and a companion `sizeChange` event:
865865

866866
+makeExample('app/my-sizer.component.ts')
@@ -870,23 +870,23 @@ block style-property-name-dart-diff
870870
Clicking the buttons increases or decreases the `size`, within min/max values constraints,
871871
and then raises (_emits_) the `sizeChange` event with the adjusted size.
872872

873-
Here's an example in which the `AppComponent.fontSizePx` is two-way bound to the `MySizerComponent`:
873+
Here's an example in which the `AppComponent.fontSizePx` is two-way bound to the `SizerComponent`:
874874

875875
+makeExcerpt('app/app.component.html', 'two-way-1', '')
876876

877877
:marked
878-
The `AppComponent.fontSizePx` establishes the initial `MySizerComponent.size` value.
878+
The `AppComponent.fontSizePx` establishes the initial `SizerComponent.size` value.
879879
Clicking the buttons updates the `AppComponent.fontSizePx` via the two-way binding.
880880
The revised `AppComponent.fontSizePx` value flows through to the _style_ binding, making the displayed text bigger or smaller.
881881
Try it in the <live-example></live-example>.
882882

883883
The two-way binding syntax is really just syntactic sugar for a _property_ binding and an _event_ binding.
884-
Angular _desugars_ the `MySizerComponent` binding into this:
884+
Angular _desugars_ the `SizerComponent` binding into this:
885885

886886
+makeExcerpt('app/app.component.html', 'two-way-2', '')
887887

888888
:marked
889-
The `$event` variable contains the payload of the `MySizerComponent.sizeChange` event.
889+
The `$event` variable contains the payload of the `SizerComponent.sizeChange` event.
890890
Angular assigns the `$event` value to the `AppComponent.fontSizePx` when the user clicks the buttons.
891891

892892
Clearly the two-way binding syntax is a great convenience compared to separate property and event bindings.

0 commit comments

Comments
 (0)