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

Not able to switch language dynamically #876

Open
adeelasghar88 opened this issue Oct 17, 2018 · 0 comments
Open

Not able to switch language dynamically #876

adeelasghar88 opened this issue Oct 17, 2018 · 0 comments

Comments

@adeelasghar88
Copy link

adeelasghar88 commented Oct 17, 2018

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?

@adeelasghar88 adeelasghar88 changed the title Cannot able to switch language dynamically Not able to switch language dynamically Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant