Can anyone assist me in converting a string to a Typescript array? Any help would be greatly appreciated.
Take a look at the following code snippet:
private validateEmptyOption(): any {
console.log("CHECKED")
let isValid = true;
this.currentForm.sections.forEach((section: Section) => {
section.fields.forEach((field: Field) => {
debugger
if (field.type === 'select') {
console.log(field)
const emptyOptionSections = JSON.parse(field.property).emptyOptionSections;
if ((emptyOptionSections !== undefined) && (emptyOptionSections == null)) {
alert('QAZWSX');
isValid = false;
}
}
return isValid;
});
});
}
After running this code, the console displays the result. Now, I need to convert this result to an array and loop through it.
https://i.sstatic.net/b91ji.png
Expected Outcome: A validation message should appear to indicate that the select controller cannot be empty.
Actual Outcome: The form can be saved without any validation.