google.maps.event.addListener(marker, 'dragend', function() {
getmydata = function() {
return $http.get("getConnectionData.php").then(function (response) {
$scope.links1 = response.data.records;
});
}
getmydata().then(function(data) {
// stuff is now in our scope, I can alert it
console.log("hiiiii" , $scope.links1);
});
});
这里我想在dragend函数之外调用此部分 - google.maps.event.addListener(marker,'dragend',function(){
getmydata().then(function(data) {
// stuff is now in our scope, I can alert it
console.log("hiiiii" , $scope.links1);
});
我该怎么办呢。
答案 0 :(得分:1)
你可以写这样的东西
{{1}}
您现在可以在任何地方拨打电话
答案 1 :(得分:1)
您需要从$http.get
电话
google.maps.event.addListener(marker, 'dragend', function() {
getmydata = function() {
return $http.get("getConnectionData.php").then(function (response) {
return response;
});
}
getmydata().then(function(data) {
// stuff is now in our scope, I can alert it
$scope.links1 = data;
console.log("hiiiii" , $scope.links1);
});
});