I'm using NgMap and I need to get the directions in a controller. I've tried the following:
NgMap.getMap().then(function(map) {
console.log(map.directionsRenderers[0].directions);
});
But it is returning undefined. I also tried using $scope.map but that is also undefined. In my view {{map.directionsRenderers[0].directions.routes[0].legs[0].distance.text}}
works as expected.
My map is as follows:
<ng-map zoom="10" center="58.637381759037865,-3.0689620971679683">
<directions
draggable="false"
panel="directions-panel"
travel-mode="WALKING"
origin="58.637381759037865,-3.0689620971679683"
destination="50.063062230661494,-5.714178085327148"></directions>
<custom-marker id="start"
position="58.637381759037865,-3.0689620971679683">
<div> Start Here </div>
</custom-marker>
<custom-marker id="end"
position="50.063062230661494,-5.714178085327148">
<div> Ends Here </div>
</custom-marker>
</ng-map>
What simple thing am I missing? Thanks.