I have two angular classes called class A , B and I have an angular component
export class B {
id:String;
Name:String;
}
My class A , Where I am passing data from a component. Where Component retrieves the data from httpclient request. Additionally I am trying to create an array of objects of class B . Which will have the size of data
export class A {
mygroupB : B[];
setData(data:any){
if((data.length) >0){
this.mygroupB = new B[data.length];
}else return;
}
}
But When I am running the code I am getting an error "B[data.length] is not a constructor" . I can't figure out, what is the mistake here. Thanks in advance.