There are a few issues that I'm struggling to resolve.
I am utilizing SwaggerService to fetch data, but the response is coming back as undefined.
import {SwaggerService} from '../../services/swagger.service';
export class TestComponent implement OnInit {
public mydata:Object;
constructor(public readonly service: SwaggerService)
{
this.service = this.service['GetData'].get().subscribe(
data=>{
this.mydata['data']=data;
},
error=>console.error(error)
);
}
}
The problem lies in the fact that data
returns an array with values, yet this.mydata['data']
returns an empty array - it's undefined.
This service is sourced from a .NET controller and upon inspection in Chrome debugger, the data is indeed present.
Should I consider implementing some form of mapping?