I try to move one angular template to another angular template. after moved i run the nswag file then i run the application. data not mapping because return result contain result keyword but nswag generated file not considering result keyword. i modified nswag generated service-proxy _data.result then only its worked C# file return result defined
{
"pastRecords": [
{
"date": "2020-01-30T04:47:05.350Z",
"value": {}
}
],
"futureRecords": [
{
"date": "2020-01-30T04:47:05.350Z",
"value": {}
}
]
}
but it's returning
{
"result": {
"pastRecords": [
{
"date": "2020-01-30T04:47:05.350Z",
"value": {}
}
],
"futureRecords": [
{
"date": "2020-01-30T04:47:05.350Z",
"value": {}
}
]
}
previous template defined _data only but its works but new template expecting _data.result
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["pastRecords"])) {
this.pastRecords = [] as any;
for (let item of _data["pastRecords"])
this.pastRecords.push(ChartSingleResultDto.fromJS(item));
}
if (Array.isArray(_data["futureRecords"])) {
this.futureRecords = [] as any;
for (let item of _data["futureRecords"])
this.futureRecords.push(ChartSingleResultDto.fromJS(item));
}
}
}
this one works previous template but new template expecting
init(_data?: any) {
if (_data) {
if (Array.isArray(_data.result["pastRecords"])) {
this.pastRecords = [] as any;
for (let item of _data.result["pastRecords"])
this.pastRecords.push(ChartSingleResultDto.fromJS(item));
}
if (Array.isArray(_data.result["futureRecords"])) {
this.futureRecords = [] as any;
for (let item of _data.result["futureRecords"])
this.futureRecords.push(ChartSingleResultDto.fromJS(item));
}
}
}