Skip to content
This repository was archived by the owner on May 11, 2020. It is now read-only.

Not able to switch language dynamically #876

@adeelasghar88

Description

@adeelasghar88

I am using ngmap version 1.18.4, angular version 1.4.9. I want to switch language but it didn't reflect. I saw couple of issues that are already discussed, e.g. #760

Above issue closed by suggesting to remove script tag. I don't have script tag which loads google-maps.

index.html:
<script src='bower_components/ngmap/build/scripts/ng-map.js'></script>

Controller code:

$scope.markers = [$scope.latitude, $scope.longitude];
$scope.mapParams = 'language=' + $scope.locale;    

$timeout(function() {
  NgMap.getMap({id: 'site-map'}).then(function(map) {
    google.maps.event.trigger(map, 'resize');
    map.setCenter(new google.maps.LatLng($scope.latitude, $scope.longitude));
  });
}, 2000);

Html code:

 <div map-lazy-load="https://maps.google.com/maps/api/js?key=abc&v=3.34" map-lazy-load-params="{{ mapParams }}">
    <ng-map id="site-map" center="{{[ latitude, longitude ]}}" zoom="question.zoom"
    >
      <marker position="{{ markers }}"></marker>
    </ng-map>
 </div>

I tried different combinations in map-lazy-load-params but nothing worked. Few combinations were:
$scope.mapParams = '&language=' + $scope.locale;
$scope.mapParams = 'https://maps.googleapis.com/maps/api/js&language=' + $scope.locale;

Static language works perfectly fine like I did this to verify map language change or not.
<div map-lazy-load="https://maps.google.com/maps/api/js?key=abc&v=3.34&language=ja">

Can someone tell me the solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions