When define response data to array, error occured:
public esriLocation = [];
public testLocation = [];
this.service.getData().subscribe(
(response) => this.esriLocation = response.json(),
(error) => console.log('ESRI ERROR: ' + error)
);
this.testLocation = this.esriLocation.suggestions;
Property 'suggestions' does not exisits on type 'any'
Responce
{
"suggestions": [{
"text": "DEU",
"key": "dHA9MCNsb2M9MTAzOTkwNTEjbG5nPTQ0I2xicz0xMDk6NDI2MDI4NzM=",
"isCollection": false
}, {
"text": "ENG",
"key": "dHA9MCNsb2M9MTA0MDAzOTcjbG5nPTQ0I2xicz0xMDk6NDI2MDI4NzU=",
"isCollection": false
}]
}
How to fix?
public esriLocation = {};Also what is the value ofconsole.log(this.esriLocationafter the service callpublic esriLocation:any; public testLocation:any;