Hi am having the following error with SonarQube 'subscribe' is deprecated. Use an observer instead of a complete callback. Am using formly in angular 9. Thank you for your help and time
onInit: (field: UiFormFieldConfig) => {
const CostsControl = FormUtil.getControl(field.form, ContactDetailsFieldKey.Costs);
CostsControl?.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((Cost: string) => {
if (Cost) {
const costsToSet = !Codes ? null : Cost;
field?.formControl?.setValue(costsToSet);
}
});
},
},
Please find updated code and yet sonarQube is popping this message 'subscribe' is deprecated. Use an observer instead of a complete callback
hooks: {
onInit: (field: UiFormFieldConfig) => {
const CostsControl = FormUtil.getControl(field.form, ContactDetailsFieldKey.Costs);
CostsControl ?.valueChanges.pipe(takeUntil(this.destroy$)).subscribe({
next: (Cost: string) => {
if (Cost) {
const costsToSet = !Codes ? null : Cost;
field?.formControl?.setValue(costsToSet);
}
},
});
},
},