요소를 성공적으로 추가하는 서비스를 사용하여 배열에 요소를 추가하고 있습니다. 데이터가 console.log로 채워진 것을 볼 수 있습니다.배열 요소에 액세스 할 수 없습니다.
그러나 요소에 액세스 할 수는 없습니다.
console.log(this.openSet[0]);
내가 '정의되지 않은'의 출력을 얻을 : 나는 같은 것을 사용하지만
this.routingService.getNode(startNode).subscribe(node => {
node.forEach(node => {
this.openSet.push(new MapNode(node.id, node.lon, node.lat, this.routingService.getNodeNeighbours(node.id)));
});
});
console.log(this.openSet); // this prints out the below screenshot
. 나는 내가 지금 어떻게 접근하고 있는지에 대해 정말로 두꺼운 지 잘 모르겠다. ...
아이디어가 있으십니까?
당신은 당신이 (JSON.stringify (this.openSet))을 console.log를 할 때 표시 게시 할 수 있습니다; – Sajeetharan
질문에 javascript 태그를 추가하십시오 – baao
가능한 [비동기 호출에서 응답을 반환하는 방법?] (https://stackoverflow.com/questions/14220321/how-to-return-the-response-from- - 비동기 호출) – baao