Answer the question
In order to leave comments, you need to log in
How to fill an array dynamically?
you need to make a collection of elements
like this
TypeScript:
for(var iteration = 1; iteration < this.countElement; iteration++)
{
this.ElementCollection[iteration]['input'] = new RangeInput(/* параметры*/);
}
Answer the question
In order to leave comments, you need to log in
Sergey, look, I figured out how to implement this, but it seems to me that this is redundant and a crutch here:
export class ElementCollection{
voltage:any;
amperage:any;
disamperage:any;
boxElement:any;
constructor(i:any,k:any,r:any){
this.amperage = i;
this.disamperage = k;
this.voltage = r;
}
}
// create input element to parametrs
export class Agregator {
wrapperBox:HTMLElement;
Collection:Array<ElementCollection> = new Array <ElementCollection>();
constructor()
{
for(var i=1; i<5; i++)
{
this.Collection[i] = new RangeInputs.ElementCollection(10+i,20,30);
}
console.log(this.Collection);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question