-1

I had this working when data was coming from static factory. Now data comes in from an AJAX call ($http) from a remote server and for some reason markers dont get put on the map.

Working plunker

Basically if I uncomment $http and replace the static data, it will not show up. It will show variable markers filled with right data, just wont populate the map

Kind of similar issue

Community
  • 1
  • 1
rodling
  • 988
  • 5
  • 18
  • 44
  • Try with ng-if and setting mode.state to true after the first batch of markers has been loaded, ng-show messes with ui-gmap in my application and positions it wrong – Sjoerd de Wit Jan 12 '15 at 14:26
  • mode.state is true. Map is clearly visible, markers are not – rodling Jan 12 '15 at 14:45
  • Found similar problem, trying to figure out from this http://stackoverflow.com/questions/22372161/using-ng-repeat-with-markers-in-ngmap – rodling Jan 12 '15 at 17:07

1 Answers1

0

i mean setting mode.state to true after the markers are loaded:

$scope.mode.state = false;
$scope.change_type = function(val) {
    var markers = [];
    $scope.eventMarkers = markers  // clear the map of markers, before loading new

    Events.venues(val.type).then(function(resp){
        var venues = $.map(resp.data, function(value, index){return [value]})  
        for (var i = 0; i < venues.length; i++) {
            event = venues[i]
            markers.push(createMarker(i,event))
        }
        console.log(markers)
        $scope.eventMarkers = markers
        $scope.mode.state = true;
    }, function(errror){
        console.debug(error)
    });
}
Sjoerd de Wit
  • 2,353
  • 5
  • 26
  • 45
  • I tried ng-if, it gives me some strange error: ` Error: Failed to execute 'appendChild' on 'Node': This node type does not support this method.` However it doesnt change anything, i had it working just fine with ng-show for static data from the factory. – rodling Jan 12 '15 at 15:17