diff --git a/aio/content/examples/reactive-forms/e2e/src/app.e2e-spec.ts b/aio/content/examples/reactive-forms/e2e/src/app.e2e-spec.ts index e22cb11f49..a322796e74 100644 --- a/aio/content/examples/reactive-forms/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/reactive-forms/e2e/src/app.e2e-spec.ts @@ -54,7 +54,7 @@ describe('Reactive forms', () => { describe('Profile Editor', () => { const firstNameInput = getInput('firstName'); const streetInput = getInput('street'); - const addAliasButton = element(by.buttonText('Add Alias')); + const addAliasButton = element(by.buttonText('+ Add another alias')); const updateButton = profileEditor.element(by.buttonText('Update Profile')); const profile: Record = { firstName: 'John', @@ -121,8 +121,7 @@ describe('Reactive forms', () => { ) ); - const aliasInputs = profileEditor.all(by.cssContainingText('label', 'Alias')); - const aliasInput = aliasInputs.get(0).element(by.css('input')); + const aliasInput = profileEditor.all(by.css('#alias-0')); await aliasInput.sendKeys(aliasText); const formValueElement = profileEditor.all(by.cssContainingText('p', 'Form Value:')); const formValue = await formValueElement.getText(); diff --git a/aio/content/examples/reactive-forms/src/app/app.component.css b/aio/content/examples/reactive-forms/src/app/app.component.css index e69de29bb2..0befc361b9 100644 --- a/aio/content/examples/reactive-forms/src/app/app.component.css +++ b/aio/content/examples/reactive-forms/src/app/app.component.css @@ -0,0 +1,3 @@ +nav a { + padding: 1rem; +} diff --git a/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.css b/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.css index c89ab4cc0b..49ae7164a2 100644 --- a/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.css +++ b/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.css @@ -1,19 +1,10 @@ -:host { - display: flex; - flex-direction: column; - padding-top: 24px; -} - label { - display: block; - width: 6em; - margin: .5em 0; - color: #607D8B; font-weight: bold; + padding-bottom: .5rem; + padding-top: 1rem; + display: inline-block; } -input { - height: 2em; - font-size: 1em; - padding-left: .4em; -} \ No newline at end of file +button { + max-width: 300px; +} diff --git a/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.html b/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.html index 95f1948ffa..e64837ef92 100644 --- a/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.html +++ b/aio/content/examples/reactive-forms/src/app/name-editor/name-editor.component.html @@ -1,21 +1,12 @@ - - + + - -

- Value: {{ name.value }} -

+

Value: {{ name.value }}

- -

- -

+ diff --git a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.1.html b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.1.html index 489bdc0781..f125ab7a8a 100644 --- a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.1.html +++ b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.1.html @@ -1,65 +1,48 @@
- - - + + + + +
-

Address

+

Address

- + + - - - + + - + + + + +
-

Aliases

+

Aliases

+
- + +
- +
-

- Form Value: {{ profileForm.value | json }} -

+

Form Value: {{ profileForm.value | json }}

-

- -

- \ No newline at end of file + + diff --git a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.css b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.css index 310e787cfe..95f895dd1e 100644 --- a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.css +++ b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.css @@ -1,39 +1,11 @@ /* ProfileEditorComponent's private CSS styles */ -:host { - display: flex; - flex-direction: column; - padding-top: 24px; + +form { + padding-top: 1rem; } label { display: block; - width: 6em; margin: .5em 0; - color: #607D8B; font-weight: bold; } - -input { - height: 2em; - font-size: 1em; - padding-left: .4em; -} - -button { - font-family: Arial, sans-serif; - background-color: #eee; - border: none; - padding: 5px 10px; - border-radius: 4px; - cursor: pointer; -} - -button:hover { - background-color: #cfd8dc; -} - -button:disabled { - background-color: #eee; - color: #ccc; - cursor: auto; -} diff --git a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.html b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.html index 20688484e3..c07b49ee3d 100644 --- a/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.html +++ b/aio/content/examples/reactive-forms/src/app/profile-editor/profile-editor.component.html @@ -2,72 +2,54 @@
- + + - + +
-

Address

+

Address

- + + - - - + + - + + + + +
-

Aliases

+

Aliases

+
- + +
+ +

Complete the form to enable button.


-

- Form Value: {{ profileForm.value | json }} -

+

Form Value: {{ profileForm.value | json }}

- -

- Form Status: {{ profileForm.status }} -

+

Form Status: {{ profileForm.status }}

-

- -

+ diff --git a/aio/content/guide/reactive-forms.md b/aio/content/guide/reactive-forms.md index 56633c39bf..7d7e53897f 100644 --- a/aio/content/guide/reactive-forms.md +++ b/aio/content/guide/reactive-forms.md @@ -13,7 +13,7 @@ Try this Reactive Forms live- Before going further into reactive forms, you should have a basic understanding of the following: * [TypeScript](https://www.typescriptlang.org/ "The TypeScript language") programming. -* Angular app-design fundamentals, as described in [Angular Concepts](guide/architecture "Introduction to Angular concepts."). +* Angular application-design fundamentals, as described in [Angular Concepts](guide/architecture "Introduction to Angular concepts."). * The form-design concepts that are presented in [Introduction to Forms](guide/forms-overview "Overview of Angular forms."). {@a intro} @@ -85,7 +85,7 @@ The form control assigned to `name` is displayed when the component is added to {@a display-value} @@ -126,7 +126,7 @@ Update the template with a button to simulate a name update. When you click the The form model is the source of truth for the control, so when you click the button, the value of the input is changed within the component class, overriding its current value.
@@ -217,7 +217,7 @@ To display the `ProfileEditor` component that contains the form, add it to a com `ProfileEditor` allows you to manage the form control instances for the `firstName` and `lastName` controls within the form group instance. {@a nested-groups} @@ -254,7 +254,7 @@ Add the `address` form group containing the `street`, `city`, `state`, and `zip` The `ProfileEditor` form is displayed as one group, but the model is broken down further to represent the logical grouping areas.
@@ -388,7 +388,7 @@ Display the current status of `profileForm` using interpolation. The **Submit** button is disabled because `profileForm` is invalid due to the required `firstName` form control. After you fill out the `firstName` input, the form becomes valid and the **Submit** button is enabled. @@ -466,7 +466,7 @@ Add the template HTML below after the `
` closing the `formGroupName` elemen The `*ngFor` directive iterates over each form control instance provided by the aliases form array instance. Because form array elements are unnamed, you assign the index to the `i` variable and pass it to each control to bind it to the `formControlName` input. Each time a new alias instance is added, the new form array instance is provided its control based on the index. This allows you to track each individual control when calculating the status and value of the root control. diff --git a/aio/content/images/guide/reactive-forms/name-editor-1.png b/aio/content/images/guide/reactive-forms/name-editor-1.png index 9806d5441a..93148353ef 100644 Binary files a/aio/content/images/guide/reactive-forms/name-editor-1.png and b/aio/content/images/guide/reactive-forms/name-editor-1.png differ diff --git a/aio/content/images/guide/reactive-forms/name-editor-2.gif b/aio/content/images/guide/reactive-forms/name-editor-2.gif new file mode 100644 index 0000000000..574aa88b54 Binary files /dev/null and b/aio/content/images/guide/reactive-forms/name-editor-2.gif differ diff --git a/aio/content/images/guide/reactive-forms/name-editor-2.png b/aio/content/images/guide/reactive-forms/name-editor-2.png deleted file mode 100644 index 4a2b1de1b6..0000000000 Binary files a/aio/content/images/guide/reactive-forms/name-editor-2.png and /dev/null differ diff --git a/aio/content/images/guide/reactive-forms/profile-editor-1.gif b/aio/content/images/guide/reactive-forms/profile-editor-1.gif new file mode 100644 index 0000000000..cead724306 Binary files /dev/null and b/aio/content/images/guide/reactive-forms/profile-editor-1.gif differ diff --git a/aio/content/images/guide/reactive-forms/profile-editor-1.png b/aio/content/images/guide/reactive-forms/profile-editor-1.png deleted file mode 100644 index e2740c36c3..0000000000 Binary files a/aio/content/images/guide/reactive-forms/profile-editor-1.png and /dev/null differ diff --git a/aio/content/images/guide/reactive-forms/profile-editor-2.png b/aio/content/images/guide/reactive-forms/profile-editor-2.png index e47e0934f9..fa764f62ed 100644 Binary files a/aio/content/images/guide/reactive-forms/profile-editor-2.png and b/aio/content/images/guide/reactive-forms/profile-editor-2.png differ diff --git a/aio/content/images/guide/reactive-forms/profile-editor-3.png b/aio/content/images/guide/reactive-forms/profile-editor-3.png index 5e202d3e10..bce861e40e 100644 Binary files a/aio/content/images/guide/reactive-forms/profile-editor-3.png and b/aio/content/images/guide/reactive-forms/profile-editor-3.png differ diff --git a/aio/content/images/guide/reactive-forms/profile-editor-4.png b/aio/content/images/guide/reactive-forms/profile-editor-4.png index 39a79e37b1..4ff04a84ce 100644 Binary files a/aio/content/images/guide/reactive-forms/profile-editor-4.png and b/aio/content/images/guide/reactive-forms/profile-editor-4.png differ