And then you are passing this variable to new google.maps.Map(document.getElementById('map'), {options}) right?
If that’s the case, try to set your style to the map after you initialize it like this:
let mapOptions = {
center: latLng,
zoom: 12,
mapTypeId: google.maps.MapTypeId.TERRAIN,
styles: this.mapStyle,
clickableIcons: false,
disableDefaultUI: true,
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER
}
var map = new google.maps.Map(document.getElementById('map'), mapOptions});
//Associate the styled map with the MapTypeId and set it to display.
map.mapTypes.set('styled_map', styledMapType);
map.setMapTypeId('styled_map');
I am using google map component in ionic creator. Below is the controller code.
i tried updating map options with style array but it didnot work. $scope.map.options = stylesArray;
You’re using Ionic 1, but Ionic 2. This is done with Ionic 2. I gave us with Ionic 1 early into getting to know it, when I started with Creator, and never looked back. With my none existent experience as a programmer (2 months) I can say for sure Ionic 2 is way easier.
Sorry that I couldn’t help… but maybe try posting as an Ionic 1 string.
hi dimitri
i’m using native google maps … i generated my chosen style
where to put my style code
my code
`
loadMap() {
let element : HTMLElement = document.getElementById(‘map’);
let map : GoogleMap = GoogleMaps.create(element );
map.one(GoogleMapsEvent.MAP_READY).then(
()=>{
console.log('map')
}
)
let ionic: LatLng = new LatLng(30.068544, 31.349004);
let position: CameraPosition <any> = {
target: ionic,
zoom: 18,
tilt: 30
};
map.moveCamera(position);
let MarkerOptions : MarkerOptions = {
position : ionic ,
title : 'anspire'
};
map.addMarker(MarkerOptions).then((marker : Marker) => {
marker.showInfoWindow();
})