In my service class, I have the following code snippet:
class UserFormService {
createUserForm() {
const userForm = new FormGroup({
firstName: new FormControl(),
lastName: new FormControl(),
displayName: new FormControl()
})
userForm.controls.firstName.valueChanges.subscribe(firstName => {
if(!userForm.value.displayName) {
userForm.controls.displayName.setValue(`${firstName} additional text`)
}
})
return userForm
}
}
The createUserForm method is invoked in the component class. Do you think it is necessary to interrupt 'valueChanges' in the given code?