http://plnkr.co/edit/Zd9GwG?p=preview谷歌地圖動態角度
我正在處理這個谷歌地圖+ angular.js的例子。我想要根據變量.i.e動態更改位置中心。我想讓它成爲動態中心。請建議如何做到這一點?
我想做一些事情就像這樣。
//代碼放在這裏
//Add the requried module 'angular-ui' as a dependency
angular.module('maptesting', ['ui.directives']);
function MapCtrl($scope) {
$scope.lat = 35.120922 ;
$scope.long = -89.97731 ;
var ll = new google.maps.LatLng($scope.lat, $scope.long);
$scope.mapOptions = {
center: ll,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Markers should be added after map is loaded
$scope.onMapIdle = function() {
//alert("DF");
if ($scope.myMarkers === undefined){
var marker = new google.maps.Marker({
map: $scope.myMap,
position: ll
});
$scope.myMarkers = [marker, ];
}
};
$scope.showMarkerInfo = function(marker) {
$scope.myInfoWindow.open($scope.myMap, marker);
};
$scope.changeval = function(){
$scope.lat = 13.0810 ;
$scope.long = 80.2740 ;
};
}
應該是什麼動態?地圖的中心?標記?更多細節請。 – Alp
爲什麼關閉?我編輯了這個問題。我需要回答先生 –