1
一种奇怪的问题/很难找到答案。我相对较新使用angularjs,并有一个我很困惑的问题。谷歌地图更新为什么要更新angularjs scope var?
我建立了一个谷歌地图,使用http://angular-ui.github.io/angular-google-maps/#!/并有问题。
所以我有一个$ scope.homeBase我在哪里设置LAT &长为业主“家庭基地”,我想使用该位置设置负载地图中心,&引脚以显示该地点。所以在我心中,酷,设置一个var并在两个位置使用它。错误。
所以这个工作负载,但每次我平移地图,我想它重新设置地图中心的位置,然后绑定到地图标记,并发送标记到屏幕中间,每泛。
反正有没有两个没有约束?或有单独的变量?没有他们的约束?
我以为一个简单的'var homebase'会删除绑定,而不会更新var。而不是使用范围,但它仍然绑定?
这也许是一个新问题,但我感谢任何指向正确的方向。
再次感谢
这是我的代码。
// uiGmapGoogleMapApi is a promise, The "then" callback function provides a maps object.
uiGmapGoogleMapApi.then(function() {
// Setting homebase coords, these will come from firebase
$scope.homeBase = { latitude: -34.18405, longitude: 150.71319 };
// Set default map.
$scope.map = {
center: $scope.homeBase,
pan: true,
zoom: 14,
events: {
click: function(){
}
}
};
// Set homebase marker.
$scope.homebaseMarker = {
id: 0,
coords: $scope.homeBase,
options: { draggable: false },
};
});