2


It's a callback for loading geoJSON file by map-data in ng-map? My code looks simple:

<ng-map map-type-control="false" zoom-to-include-markers="true">
    <map-data load-geo-json="myPlace.geojson"></map-data>
</ng-map>

My GeoJSON loads some time and I would like to add some angular Spinner for this load time. It is any possible to do this?

radek.
  • 368
  • 1
  • 3
  • 16

1 Answers1

0

There's an example with sort of callback (uses Promises) in the docs: https://ngmap.github.io/#/!geojson.html that calls NgMap.getMap() method of a NgMap service. So you can display loader untill

//controller
app.controller('MyCtrl', function(NgMap) {
 vm.loaded = false; //property to toggle visibility
 NgMap.getMap().then(function(map) {
    vm.map = map;
    vm.loaded = true;//update on JSON loaded
  });
//..other stuff



<!-- template-->
<!--loader block-->
<div class="loader" ng-show="!loaded"></div>

<!--map is hidden untill json loaded-->
<ng-map ng-show="loaded" zoom="4" center="39.02, -95.81">
  <map-data load-geo-json="us-states-20m.json">
  </map-data>
</ng-map>
shershen
  • 9,875
  • 11
  • 39
  • 60