나는 angular js에 새로 왔으며 내 json lat lon 데이터를 goole api에 전달하려고합니다. 내 json 파일 구조
{
"totalCount":206,
"deals":[{
"id":"2",
"Name":"samir",
"locations":[{
"location":"Mundhwa Gaon",
"address":"Mundhwa Gaon, North Main Road, Pune - 411 001",
"latLon":"18.53918870,73.90790910"
},
"location":"Mundhwa Gaon",
"address":"Mundhwa Gaon, North Main Road, Pune - 411 001",
"latLon":"18.53918870,73.90790910"
},
]
}]
}
내 각도 js 코드
$http({method: 'GET', url: '/api/v1/asas}).success(function(data) {
$scope.deal = data.deals;
if(data.deals.hasOwnProperty("locations") && data.deals.locations!=null){
var location=$scope.deal.locations[0]['latLon'];
var locationlatlong=location.split(",");
$scope.map = {center: {latitude: locationlatlong[0], longitude: locationlatlong[1] }, zoom: 4 }
$scope.options = {scrollwheel: false};
var markers = [];
for (var i = 0; i < $scope.deal.locations.length; i++) {
markers.push(createmarker(i, $scope.deal.locations[i]['location'], $scope.deal.locations[i]['latLon'],$scope.deal.locations[i]['address']))
}
$scope.markers = markers;
if(badBrowser){
$scope.rendermap=false;
}else{
$scope.rendermap=true;
}
}
});
그러나 그들이 가치를 얻지 못하기 때문에 내 if 조건이 작동하지 않습니다. 각도 js 1.2.23을 사용하고 있습니다.
는 deals
어레이의 각 요소는 하나의 거래에 대한 필드를 포함하는 객체는, 사용자가 위에 루프를 사용해야 인 배열 data.deals[i]
i 번째 거래 액세스 데이터.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다