Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help me implement the requirements of the question below to fit into my already code in my profile editor. component. html . The remaining code
Help me implement the requirements of the question below to fit into my already code in my profile editor. component. html The remaining code after state in the profile editor.component code is below. zip:
aliases: this.formBuilder.arraythisformBuilder.control
;
onSubmit
console.warnthisprofileForm.value;
updateProfile
this.profileForm.patchValue
firstName: 'Nancy',
lastName: 'Stone',
street: Drew Street',
;
get aliases
return this.profileForm.getaliases as FormArray;
addAlias
this.aliases.pushthisformBuilder.control;
question of the assignment
Implement an event binding so that when the user enters a Zip code on the form, it automatically fills the City based on the zip code entered. Here is a list of zip codes and the cities near the university that you can use for the assignment. Please note that the list is not exhaustive and you may choose to include more zip codes or cities. You can use the USPS Zip Code Lookupthis link opens in a new windowtab tool to find more zip codes.
Kennesaw:
Marietta:
Woodstock:
To limit the scope of the assignment, you will hard code the zip codes and the corresponding cities in the program. You DO NOT need to integrate with the USPS Zip Code Lookup API.
You may choose to autofill the State based on the zip code as well, but it is not required.
Create a lab report using Word and insert screenshots demonstrating both the code snippets and the results of the autofill in the browser. The screenshots MUST contain the URL in the browser window.
Hint
You may bind with the DOM event onchange, and then create a function onZipChange in the ts file to handle the event. Keep in mind that you will have to move your cursor out of the Zip input field in order to trigger the onchange event. Other options to consider are onblur, onkeyup, etc.
To retrieve the value from a nested FormGroup item, use the getter method.
The Profile Editor form from the Reactive Forms tutorial. Code to get the value of Zip from user input.
let postalcode this.profileForm.getaddressgetzipvalue;
I recommend that you create a separate function getCityByZipzip: string or something similar to handle the task of locating the city by zip code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started