angularjs - Why I get this error with angular and leaflet -
i set in separated files different components, when aggregate search input, error in local:
angular.js:13424 error: map container not found.
and in plunker:
angular.js:13424error: map container initialized.
the strange thing map works well. what's wrong?
you have initialized map twice, 1 in basemapcontroller
, in inputcontroller
.
in basemapcontroller
, replace
_map = basemapservice.mapelement();
with
$scope.map = basemapservice.mapelement(); _map=$scope.map;
in inputcontroller
, replace
basemapservice.autocomplete(_searchinputid).bindto('bounds', basemapservice.mapelement());
with
basemapservice.autocomplete(_searchinputid).bindto('bounds', $scope.map);
hope solve problem.
update:
in demo, auto-complete works fine not bound map. example if search place, not find place on map. have resolve error have mentioned.
for auto-complete, have used google api , basemap
, have used leaflet
.
my suggestion is: rather mixing these both approaches, either use leaflet.googleautocomplete or google maps javascript api
Comments
Post a Comment