Here is an example of how I work with arrays in my code:
var alphas: string[];
alphas = ['abc1', 'abc2', 'abc3']; // (this array can be changed)
My modal class looks like this:
export class Team {
TeamName: string;
}
To assign the values from the 'alphas' array to the 'TeamName', I do the following:
let selectedTeams = [];
for(let i = 0; i < alphas.length; i++) {
let team: Team = new Team();
team.TeamName = alphas[i];
selectedTeams.push(team);
}
After that, I need to call a method in the following way:
this.selectedReferredTo = [selectedTeams[1], selectedTeams[2], selectedTeams[3]];
However, I'm facing an issue when working with arrays of different sizes. Can someone help me figure out how to handle this?