I have following code
export class FormComponent implements OnInit {
name: string;
empoloyeeID : number;
empList: Array<{name: string, empoloyeeID: number}> = [];
constructor() {
}
ngOnInit() {
}
onEmpCreate(){
console.log(this.name,this.empoloyeeID);
this.empList.push.apply(this.name,this.empoloyeeID);
this.name ="";
this.empoloyeeID = 0;
}
}
but this throwing error
CreateListFromArrayLike called on non-object
Also is there any way to create a custom class and used object list rather than defining array over here.
Thanks