diff --git a/aio/content/examples/reactive-forms/debug.log b/aio/content/examples/reactive-forms/debug.log new file mode 100644 index 0000000000..9c0793f598 --- /dev/null +++ b/aio/content/examples/reactive-forms/debug.log @@ -0,0 +1,3 @@ +[1030/162525.401:ERROR:process_reader_win.cc(123)] NtOpenThread: {Acceso denegado} Un proceso ha solicitado acceso a un objeto, pero no se le han concedido esos derechos de acceso. (0xc0000022) +[1030/162525.402:ERROR:exception_snapshot_win.cc(87)] thread ID 26896 not found in process +[1030/162525.402:WARNING:crash_report_exception_handler.cc(62)] ProcessSnapshotWin::Initialize failed diff --git a/aio/content/examples/reactive-forms/src/app/app.component.1.html b/aio/content/examples/reactive-forms/src/app/app.component.1.html new file mode 100644 index 0000000000..14316fbe62 --- /dev/null +++ b/aio/content/examples/reactive-forms/src/app/app.component.1.html @@ -0,0 +1,4 @@ +
+

Reactive Forms

+ +
diff --git a/aio/content/examples/reactive-forms/src/app/app.component.1.ts b/aio/content/examples/reactive-forms/src/app/app.component.1.ts deleted file mode 100644 index 1cb532fdfe..0000000000 --- a/aio/content/examples/reactive-forms/src/app/app.component.1.ts +++ /dev/null @@ -1,12 +0,0 @@ -// #docregion -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - template: ` -
-

Reactive Forms

- -
` -}) -export class AppComponent { } diff --git a/aio/content/examples/reactive-forms/src/app/app.component.css b/aio/content/examples/reactive-forms/src/app/app.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/aio/content/examples/reactive-forms/src/app/app.component.html b/aio/content/examples/reactive-forms/src/app/app.component.html new file mode 100644 index 0000000000..b7d0e6d580 --- /dev/null +++ b/aio/content/examples/reactive-forms/src/app/app.component.html @@ -0,0 +1,4 @@ +
+

Reactive Forms

+ +
diff --git a/aio/content/examples/reactive-forms/src/app/app.component.ts b/aio/content/examples/reactive-forms/src/app/app.component.ts index cbde762e5f..f7baece9b5 100644 --- a/aio/content/examples/reactive-forms/src/app/app.component.ts +++ b/aio/content/examples/reactive-forms/src/app/app.component.ts @@ -3,10 +3,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-root', - template: ` -
-

Reactive Forms

- -
` + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] }) export class AppComponent { } diff --git a/aio/content/examples/reactive-forms/src/app/app.module.ts b/aio/content/examples/reactive-forms/src/app/app.module.ts index a965cece94..1772861c85 100644 --- a/aio/content/examples/reactive-forms/src/app/app.module.ts +++ b/aio/content/examples/reactive-forms/src/app/app.module.ts @@ -6,9 +6,9 @@ import { BrowserModule } from '@angular/platform-browser'; import { ReactiveFormsModule } from '@angular/forms'; // <-- #1 import module import { AppComponent } from './app.component'; -import { HeroDetailComponent } from './hero-detail.component'; // <-- #1 import component +import { HeroDetailComponent } from './hero-detail/hero-detail.component'; // <-- #1 import component // #enddocregion v1 -import { HeroListComponent } from './hero-list.component'; +import { HeroListComponent } from './hero-list/hero-list.component'; import { HeroService } from './hero.service'; // <-- #1 import service // #docregion v1 @@ -20,7 +20,7 @@ import { HeroService } from './hero.service'; // <-- #1 import service ], declarations: [ AppComponent, - HeroDetailComponent, // <-- #3 declare app component + HeroDetailComponent, // #enddocregion v1 HeroListComponent // #docregion v1 diff --git a/aio/content/examples/reactive-forms/src/app/demo.module.ts b/aio/content/examples/reactive-forms/src/app/demo.module.ts index dac9145ca9..a8b71ab5b6 100644 --- a/aio/content/examples/reactive-forms/src/app/demo.module.ts +++ b/aio/content/examples/reactive-forms/src/app/demo.module.ts @@ -4,14 +4,14 @@ import { ReactiveFormsModule } from '@angular/forms'; import { AppModule } from './app.module'; import { DemoComponent } from './demo.component'; -import { HeroDetailComponent1 } from './hero-detail-1.component'; -import { HeroDetailComponent2 } from './hero-detail-2.component'; -import { HeroDetailComponent3 } from './hero-detail-3.component'; -import { HeroDetailComponent4 } from './hero-detail-4.component'; -import { HeroDetailComponent5 } from './hero-detail-5.component'; -import { HeroDetailComponent6 } from './hero-detail-6.component'; -import { HeroDetailComponent7 } from './hero-detail-7.component'; -import { HeroDetailComponent8 } from './hero-detail-8.component'; +import { HeroDetailComponent1 } from './hero-detail/hero-detail-1.component'; +import { HeroDetailComponent2 } from './hero-detail/hero-detail-2.component'; +import { HeroDetailComponent3 } from './hero-detail/hero-detail-3.component'; +import { HeroDetailComponent4 } from './hero-detail/hero-detail-4.component'; +import { HeroDetailComponent5 } from './hero-detail/hero-detail-5.component'; +import { HeroDetailComponent6 } from './hero-detail/hero-detail-6.component'; +import { HeroDetailComponent7 } from './hero-detail/hero-detail-7.component'; +import { HeroDetailComponent8 } from './hero-detail/hero-detail-8.component'; @NgModule({ imports: [ diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-1.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-1.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-1.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-1.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-1.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-1.component.ts similarity index 59% rename from aio/content/examples/reactive-forms/src/app/hero-detail-1.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-1.component.ts index 75b02a36c0..7ce88f3522 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-1.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-1.component.ts @@ -1,8 +1,9 @@ /* tslint:disable:component-class-suffix */ -// #docregion imports -import { Component } from '@angular/core'; -import { FormControl } from '@angular/forms'; -// #enddocregion + +import { Component } from '@angular/core'; +// #docregion import +import { FormControl } from '@angular/forms'; +// #enddocregion import @Component({ selector: 'app-hero-detail-1', diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-2.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-2.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-2.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-2.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-2.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-2.component.ts similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-2.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-2.component.ts diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-3.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-3.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-3.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3.component.ts similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-3.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3.component.ts diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-3a.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3a.component.ts similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-3a.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-3a.component.ts diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-4.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-4.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-4.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-4.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-4.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-4.component.ts similarity index 94% rename from aio/content/examples/reactive-forms/src/app/hero-detail-4.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-4.component.ts index 1c3cc8e1ff..b9a61aa1ea 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-4.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-4.component.ts @@ -3,7 +3,7 @@ import { Component } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { states } from './data-model'; +import { states } from '../data-model'; // #enddocregion imports @Component({ diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-5.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-5.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-5.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-5.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-5.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-5.component.ts similarity index 95% rename from aio/content/examples/reactive-forms/src/app/hero-detail-5.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-5.component.ts index edafd9db79..1193265c5b 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-5.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-5.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { states } from './data-model'; +import { states } from '../data-model'; @Component({ selector: 'app-hero-detail-5', diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-6.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-6.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-6.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-6.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-6.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-6.component.ts similarity index 96% rename from aio/content/examples/reactive-forms/src/app/hero-detail-6.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-6.component.ts index 903cabb00e..39d18bffab 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-6.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-6.component.ts @@ -5,7 +5,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; // #docregion import-hero -import { Hero, states } from './data-model'; +import { Hero, states } from '../data-model'; // #enddocregion import-hero ////////// 6 //////////////////// diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-7.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-7.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-7.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-7.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-7.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-7.component.ts similarity index 96% rename from aio/content/examples/reactive-forms/src/app/hero-detail-7.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-7.component.ts index fc05703c52..d12d06f070 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-7.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-7.component.ts @@ -5,7 +5,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; // #docregion import-address -import { Address, Hero, states } from './data-model'; +import { Address, Hero, states } from '../data-model'; // #enddocregion import-address // #enddocregion imports diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-8.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-8.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail-8.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-8.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail-8.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-8.component.ts similarity index 96% rename from aio/content/examples/reactive-forms/src/app/hero-detail-8.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-8.component.ts index d18386afd2..f782eb1fcb 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail-8.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail-8.component.ts @@ -3,7 +3,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Address, Hero, states } from './data-model'; +import { Address, Hero, states } from '../data-model'; // #enddocregion imports @Component({ diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.css b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail.component.html b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-detail.component.html rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-detail.component.ts b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.ts similarity index 92% rename from aio/content/examples/reactive-forms/src/app/hero-detail.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.ts index 7afb42da3a..bf6d64a0fa 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-detail.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-detail/hero-detail.component.ts @@ -3,17 +3,16 @@ import { Component, Input, OnChanges } from '@angular/core'; import { FormArray, FormBuilder, FormGroup } from '@angular/forms'; -import { Address, Hero, states } from './data-model'; +import { Address, Hero, states } from '../data-model'; // #docregion import-service -import { HeroService } from './hero.service'; +import { HeroService } from '../hero.service'; // #enddocregion import-service -// #docregion metadata @Component({ selector: 'app-hero-detail', - templateUrl: './hero-detail.component.html' + templateUrl: './hero-detail.component.html', + styleUrls: ['./hero-detail.component.css'] }) -// #enddocregion metadata export class HeroDetailComponent implements OnChanges { @Input() hero: Hero; diff --git a/aio/content/examples/reactive-forms/src/app/hero-list.component.1.html b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.1.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-list.component.1.html rename to aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.1.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.css b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/aio/content/examples/reactive-forms/src/app/hero-list.component.html b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.html similarity index 100% rename from aio/content/examples/reactive-forms/src/app/hero-list.component.html rename to aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.html diff --git a/aio/content/examples/reactive-forms/src/app/hero-list.component.ts b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts similarity index 79% rename from aio/content/examples/reactive-forms/src/app/hero-list.component.ts rename to aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts index 08e3b5f13b..409d42eb07 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-list.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts @@ -3,12 +3,13 @@ import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/finally'; -import { Hero } from './data-model'; -import { HeroService } from './hero.service'; +import { Hero } from '../data-model'; +import { HeroService } from '../hero.service'; @Component({ selector: 'app-hero-list', - templateUrl: './hero-list.component.html' + templateUrl: './hero-list.component.html', + styleUrls: ['./hero-list.component.css'] }) export class HeroListComponent implements OnInit { heroes: Observable; diff --git a/aio/content/examples/reactive-forms/src/index-final.html b/aio/content/examples/reactive-forms/src/index-final.html index 0471ac467d..6abb00da3b 100644 --- a/aio/content/examples/reactive-forms/src/index-final.html +++ b/aio/content/examples/reactive-forms/src/index-final.html @@ -5,10 +5,8 @@ Hero Form - - - + diff --git a/aio/content/examples/reactive-forms/src/index.html b/aio/content/examples/reactive-forms/src/index.html index fcde39cdce..7121ad3455 100644 --- a/aio/content/examples/reactive-forms/src/index.html +++ b/aio/content/examples/reactive-forms/src/index.html @@ -5,9 +5,7 @@ Hero Form - - diff --git a/aio/content/examples/reactive-forms/src/styles.1.css b/aio/content/examples/reactive-forms/src/styles.1.css new file mode 100644 index 0000000000..167a66be4f --- /dev/null +++ b/aio/content/examples/reactive-forms/src/styles.1.css @@ -0,0 +1 @@ +@import url('https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css'); diff --git a/aio/content/guide/reactive-forms.md b/aio/content/guide/reactive-forms.md index 929bf17dcc..3a3a8cc517 100644 --- a/aio/content/guide/reactive-forms.md +++ b/aio/content/guide/reactive-forms.md @@ -128,11 +128,13 @@ Then you'll learn about the [Angular form classes](guide/reactive-forms#essentia ## Setup -Follow the steps in the [_Setup_ guide](guide/setup "Setup guide") -for creating a new project folder (perhaps called `reactive-forms`) -based on the _QuickStart seed_. +Create a new project named angular-reactive-forms: + + ng new angular-reactive-forms + + {@a data-model} @@ -140,15 +142,21 @@ based on the _QuickStart seed_. ## Create a data model The focus of this guide is a reactive forms component that edits a hero. You'll need a `hero` class and some hero data. -Create a new `data-model.ts` file in the `app` directory and copy the content below into it. +Using the CLI, generate a new class named `data-model`: + + + + ng generate class data-model + + + +And copy the content below: - - The file exports two classes and two constants. The `Address` and `Hero` classes define the application _data model_. The `heroes` and `states` constants supply the test data. @@ -159,32 +167,26 @@ The `heroes` and `states` constants supply the test data. ## Create a _reactive forms_ component -Make a new file called -`hero-detail.component.ts` in the `app` directory and import these symbols: +Generate a new component named `HeroDetail`: - + + + ng generate component HeroDetail +And import: - -Now enter the `@Component` decorator that specifies the `HeroDetailComponent` metadata: - - - + - - -Next, create an exported `HeroDetailComponent` class with a `FormControl`. +Next, update the `HeroDetailComponent` class with a `FormControl`. `FormControl` is a directive that allows you to create and manage a `FormControl` instance directly. - - - + @@ -218,10 +220,10 @@ read the [Form Validation](guide/form-validation) guide. ## Create the template -Now create the component's template, `src/app/hero-detail.component.html`, with the following markup. +Now update the component's template, with the following markup. - + @@ -255,13 +257,11 @@ It _styles_ the form but in no way impacts the logic of the form. The HeroDetailComponent template uses `formControlName` directive from the `ReactiveFormsModule`. -In this sample, you declare the `HeroDetailComponent` in the `AppModule`. -Therefore, do the following three things in `app.module.ts`: +Do the following two things in `app.module.ts`: 1. Use a JavaScript `import` statement to access -the `ReactiveFormsModule` and the `HeroDetailComponent`. +the `ReactiveFormsModule`. 1. Add `ReactiveFormsModule` to the `AppModule`'s `imports` list. -1. Add `HeroDetailComponent` to the declarations array. @@ -277,7 +277,7 @@ the `ReactiveFormsModule` and the `HeroDetailComponent`. ## Display the _HeroDetailComponent_ Revise the `AppComponent` template so it displays the `HeroDetailComponent`. - + @@ -312,10 +312,10 @@ You'll learn more about these classes as you work through this guide. ### Style the app You used bootstrap CSS classes in the template HTML of both the `AppComponent` and the `HeroDetailComponent`. -Add the `bootstrap` _CSS stylesheet_ to the head of `index.html`: +Add the `bootstrap` _CSS stylesheet_ to the head of `styles.css`: - + @@ -340,7 +340,7 @@ This is simple to do. To add a `FormGroup`, add it to the imports section of `hero-detail.component.ts`: - + @@ -349,7 +349,7 @@ of `hero-detail.component.ts`: In the class, wrap the `FormControl` in a `FormGroup` called `heroForm` as follows: - + @@ -359,7 +359,7 @@ Now that you've made changes in the class, they need to be reflected in the template. Update `hero-detail.component.html` by replacing it with the following. - + @@ -418,7 +418,7 @@ To see the form model, add the following line after the closing `form` tag in the `hero-detail.component.html`: - + @@ -458,7 +458,7 @@ clutter by handling details of control creation for you. To use `FormBuilder`, you need to import it into `hero-detail.component.ts`: - + @@ -474,7 +474,7 @@ by following this plan: The revised `HeroDetailComponent` looks like this: - + @@ -497,7 +497,7 @@ demonstrates the simplicity of using `Validators.required` in reactive forms. First, import the `Validators` symbol. - + @@ -509,7 +509,7 @@ The first item is the initial value for `name`; the second is the required validator, `Validators.required`. - + @@ -529,7 +529,7 @@ Configuring validation is harder in template-driven forms where you must wrap va Update the diagnostic message at the bottom of the template to display the form's validity status. - + @@ -564,7 +564,7 @@ A hero has an address, a super power and sometimes a sidekick too. The address has a state property. The user will select a state with a `