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

Commit 6ef1000

Browse files
watchName -> logChangeName
1 parent fc8e420 commit 6ef1000

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

public/docs/_examples/reactive-forms/ts/app/hero-detail-1.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- #docregion basic-form-->
22
<h2>Hero Detail</h2>
3-
<h3><i>A simple form with a single FormControl</i></h3>
3+
<h3><i>FormGroup with a single FormControl</i></h3>
44
<form [formGroup]="heroForm" novalidate>
55
<div class="form-group">
66
<label>Name:</label>

public/docs/_examples/reactive-forms/ts/app/hero-detail-2.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- #docregion basic-form-->
22
<h2>Hero Detail</h2>
3-
<h3><i>A simple form with a single FormControl using FormBuilder</i></h3>
3+
<h3><i>A FormGroup with a single FormControl using FormBuilder</i></h3>
44
<form [formGroup]="heroForm" novalidate>
55
<div class="form-group">
66
<label>Name:</label>

public/docs/_examples/reactive-forms/ts/app/hero-detail-3.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- #docregion -->
22
<h2>Hero Detail</h2>
3-
<h3><i>A simple form with multiple FormControls in a single FormBuilder group</i></h3>
3+
<h3><i>A FormGroup with multiple FormControls</i></h3>
44
<form [formGroup]="heroForm" novalidate>
55
<div class="form-group">
66
<label>Name:</label>

public/docs/_examples/reactive-forms/ts/app/hero-detail.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<form [formGroup]="heroForm" (ngSubmit)="onSubmit()" novalidate>
55
<div style="margin-bottom: 1em">
66
<button type="submit"
7-
[disabled]="!heroForm.dirty" class="btn btn-success">Save</button> &nbsp;
7+
[disabled]="heroForm.pristine" class="btn btn-success">Save</button> &nbsp;
88
<button type="reset" (click)="revert()"
9-
[disabled]="!heroForm.dirty" class="btn btn-danger">Revert</button>
9+
[disabled]="heroForm.pristine" class="btn btn-danger">Revert</button>
1010
</div>
1111

1212
<!-- Hero Detail Controls -->

public/docs/_examples/reactive-forms/ts/app/hero-detail.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ export class HeroDetailComponent implements OnChanges {
2121
// #enddocregion save-emitter
2222

2323
heroForm: FormGroup;
24-
// #docregion watch-name
24+
// #docregion log-name-change
2525
nameChangeLog: string[] = [];
26-
// #enddocregion watch-name
26+
// #enddocregion log-name-change
2727
states = states;
2828

2929
// #docregion ctor
3030
constructor(private fb: FormBuilder) {
3131
this.createForm();
32-
this.watchName();
32+
this.logNameChange();
3333
}
3434
// #enddocregion ctor
3535

@@ -95,12 +95,12 @@ export class HeroDetailComponent implements OnChanges {
9595
revert() { this.ngOnChanges(); }
9696
// #enddocregion revert
9797

98-
// #docregion watch-name
99-
watchName() {
98+
// #docregion log-name-change
99+
logNameChange() {
100100
const nameControl = this.heroForm.get('name') as FormControl;
101101
nameControl.valueChanges.forEach(
102102
(value: string) => this.nameChangeLog.push(value)
103103
);
104104
}
105-
// #enddocregion watch-name
105+
// #enddocregion log-name-change
106106
}

public/docs/ts/latest/guide/reactive-forms.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,14 +749,14 @@ a#observe-control
749749
You don't need to know much about RxJS `Observable` to watch for a form control value change.
750750

751751
Add the following method to watch for changes to the value of the _name_ `FormControl`.
752-
+makeExample('reactive-forms/ts/app/hero-detail.component.ts', 'watch-name','app/hero-detail.component.ts (watchName)')(format=".")
752+
+makeExample('reactive-forms/ts/app/hero-detail.component.ts', 'log-name-change','app/hero-detail.component.ts (logNameChange)')(format=".")
753753

754754
:marked
755755
Call it in the constructor, after creating the form.
756756
+makeExample('reactive-forms/ts/app/hero-detail.component.ts', 'ctor')(format=".")
757757

758758
:marked
759-
The `watchName` method pushes name-change values into a `nameChangeLog` array.
759+
The `logNameChange` method pushes name-change values into a `nameChangeLog` array.
760760
Display that array at the bottom of the component template with this `*ngFor` binding:
761761
+makeExample('reactive-forms/ts/app/hero-detail.component.html', 'name-change-log','app/hero-detail.component.html (Name change log)')(format=".")
762762

0 commit comments

Comments
 (0)