Currently my project is using Angular 10 and I have a specific requirement. In the function below, I need to pass in a filter variable dynamically so that I can extract the startValue property from it.
let filter = "AgeRange";
ValidateValues(endValue: string,filter:string){
startValue = this.SearchFields.{filter}.Start;
}
The structure of SearchFields is as shown:
export class SearchFilters{
Gender: string = "Select";
AgeRange:StartEndValues = new StartEndValues;
CsaScore: StartEndValues = new StartEndValues;
FarmSize: StartEndValues = new StartEndValues;
PracticeCategory:string = "Select";
public constructor(init?:Partial<SearchFilters>){
Object.assign(this, init);
}
}
export class StartEndValues{
Start: string = "Select";
End: string="Select";
public constructor(init?:Partial<StartEndValues>){
Object.assign(this,init)
}
}