如何在agm-map中添加自定义Google Maps样式XML [英] How to add custom google maps styling xml in agm-map
问题描述
我正尝试在 https://mapstyle.withgoogle.com/,自定义Google地图样式.
I am trying to customize the google maps with the help of https://mapstyle.withgoogle.com/, custom google maps styling.
我正在使用Google角度地图( https://github.com/SebastianM/angular-google-maps )库中.
I am using angular google maps(https://github.com/SebastianM/angular-google-maps) library in my angular app.
我想包含XML,以便以自定义样式显示agm-map.但是我不知道如何在agm-map中做到这一点.
I want to include the XML so that the agm-map is displayed with custom styles. But I don't know how to do it in agm-map.
请帮助我.
推荐答案
初始化地图时,您必须提供样式指令:
You have to provide the style directive when you initialize your map :
<agm-map
[latitude]="lat"
[longitude]="lng"
[styles]="styles"
[zoom]="zoom"
[disableDefaultUI]="false"
[zoomControl]="false"
(mapClick)="mapClicked($event)">
样式是您在 https://mapstyle.withgoogle.com/
Here is a quick example i created : https://stackblitz.com/edit/angular-google-maps-demo-mgxqnr?file=app/app.component.ts
这篇关于如何在agm-map中添加自定义Google Maps样式XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!