In my component created the variable with the of any[], as per my requirement dynamic value will come from service based on that variable has to create and assign the value.
export class CostsComponent implements OnInit {
public info: any[] = [];
constructor(private deliverablesService: DeliverablesService, private setupcostsService: SetupcostsService, private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.activatedRoute.params.subscribe((params: Params) => {
this.setupcostsService.getcostDetails(2940).subscribe(
data => {
this.info.col = data.col; // dynamic
this.info.data = data.data; //dynamic
console.log('cost Info',data);
},
() => { }
);
});
}
while setting this.info.col
getting the Property 'col' does not exist on type 'any[]'
. error.