You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: public/docs/ts/latest/guide/reactive-forms.jade
+13-10
Original file line number
Diff line number
Diff line change
@@ -126,25 +126,28 @@ a#formbuilder
126
126
`FormBuilder` is a class that helps reduce repetition and clutter by doing some of the heavy lifting behind the scenes.
127
127
You've already imported `FormBuilder` into `hero-signup.component.ts`.
128
128
129
-
To take advantage of `FormBuilder`, `HeroSignUpComponent` needs refactoring. In the component class, let Angular know that `form` is of type `FormGroup`. Then use the constructor method and inject `FormBuilder` with `constructor(public fb: FormBuilder)`. Inside the constructor, you can use `FormBuilder` to set the `form` as a `FormBuilder` group which lets you instantiate the **FormControls** by simply using the `formControlName` and in this case, an empty value. In this way, `FormBuilder` instantiates each `FormControl` for you, reducing repetitive code. Now, you don't have to use `new` over and over.
129
+
To take advantage of `FormBuilder`, `HeroSignUpComponent` needs refactoring. In the component class, let Angular
130
+
know that `form` is of type `FormGroup`.
131
+
132
+
Then use the constructor method and inject `FormBuilder` with
133
+
`constructor(public fb: FormBuilder)`. Inside the constructor, you can use `FormBuilder` to set the
134
+
`form` as a group, which lets you instantiate the **FormControls** by simply using the `formControlName`
135
+
and in this case, an empty value. In this way, `FormBuilder` instantiates each `FormControl` for you,
136
+
reducing repetitive code. Now, you don't have to use `new` over and over.
0 commit comments