I've got a form where I'm asking a user to select a project title. Along with that project title (when selected), I'd like to also grab two more values associated with that selection - then, use those values to add to form data that I'll end up saving to my database. The select list option that's being looped over contains a lot of data, more than just the project title. I'd like to use some of that data when this selection is made.
In the HTML, I'm looping over 'projects' and asking a user to select one. Easy enough. When they select this choice they automatically populate the 'formControlName' with the value property. In essence, I'd like to also populate more 'formControlName's with this select value - kind of like using multiple VALUE propertys in this select. I do know that I can interpolate more in the value property but it overloads the 'formControlName'
There are two other properties of this 'project' selection I'd like to grab - projectManager._id and projectManager.email - I want to save those values along with the form when saving
----- HTML -----
<!-- PROJECT -->
<div class="form-group col-sm-4">
<label>Project</label>
<select class="custom-select form-control" formControlName="project">
<option *ngFor="let project of projects" value="{{project?._id}}">
{{ project.projectTitle | titlecase }}
</option>
</select>
</div>
----- TS ------
// INITIATE THE FORM
this.requestForm = this.fb.group({
userId: this.currentUser.id,
userEmail: this.currentUser.email,
projectManagerId: '',
projectManagerEmail: '',
department: '',
project: '',
episode: '',
requestItems: this.fb.array([
this.fb.group({
timecodeIn: '',
timecodeOut: '',
reason: '',
line: '',
note: ''
})
])
});