赋值后变量未定义 AngularJS

Variable goes undefined after assignement AngularJS

我正在使用 $http.get 方法从 json 文件中获取对象。它将它们作为对象数组放入数据变量中。我第一次尝试使用对象中包含的变量来初始化它起作用的标记,但随后变量消失了,并且控制台在我尝试覆盖 .center 值的行上给了我 "TypeError: Cannot set property 'center' of undefined" ,并且甚至警报也没有给出任何信息。

var mapOptions =
{
    center: new google.maps.LatLng(0, 0),
    zoom: 16,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map"), mapOptions);

var marker = new google.maps.Marker({
    position: new google.maps.LatLng(0, 0),
    map: map,
    title: 'Uluru (Ayers Rock)'
});

$http.get("buses/buses.json").success(function(data){
    console.log(angular.isArray(data));
    marker.position = new google.maps.LatLng(data[1].lat, data[1].lon);
    alert(data[1].lon);
    map.mapOptions.center = marker.position;
    alert(data[1].lon);
});

如果是 map.setCenter(marker.position); 不应该吗?