user-infobut feel free to name it whatever you want.
AppModuleand add it to the imports array.
FormControlclass and we can do so by creating a new instance of this class in the
[(ngModel)]in template-driven form.
FormGroupand all the
FormControls. Take a moment to do so by using the documentation to create a FormGroup from angular.io.
requiredattribute to HTML elements to force inputs as required but the HTML attribute may not enough. To properly handle form validation, each
FormControlshould define its own validation rules. Take a moment to read through the form validation section on angular.io and add the appropriate validation rules in your code.
invalidproperty on the form. It will look like
gatheredUserInfo. We encourage you to create new type that reflects the structure of data of the form (feel free to define the new interface in the same
.tsfile - above or below component class declaration).
FormGroupthat allows you to get the raw data of the form from the angular.io documentation. Save the data inside a variable and reference it inside
onSubmit()method. Try challenging yourself to read the documentation and applying the concepts yourself before asking for help. 💪
FormGroupcomes with very powerful methods such as
patchValue. You may have already come across those methods when looking for
getRawValue. Let's try it out!
enable()method on the control like this-