I have angular 8 application and I can show a popup.
But I want to style the popup. But how to do that?
SO I have this template:
JavaScript
x
20
20
1
<mgl-layer
2
*ngIf="imageLoaded"
3
id="camera"
4
type="symbol"
5
[source]="{
6
type: 'geojson',
7
data: {
8
type: 'FeatureCollection',
9
10
}
11
}"
12
(click)= "onClick($event)"
13
[layout]="{'icon-image': 'camera', 'icon-size': 0.25}"
14
>
15
</mgl-layer>
16
<mgl-popup *ngIf="selectedPoint" [feature]="selectedPoint">
17
<span [innerHTML]="selectedPoint.properties?.description"></span>
18
</mgl-popup>
19
20
and ts:
JavaScript
1
18
18
1
allWifiPoints = this.wifiPoints.map((wifi) => ({
2
type: 'Feature',
3
properties: {
4
description:
5
// eslint-disable-next-line max-len
6
},
7
geometry: {
8
type: 'Point',
9
coordinates: wifi,
10
},
11
}));
12
13
14
onClick(evt: MapLayerMouseEvent) {
15
this.selectedPoint = evt.features![0];
16
}
17
18
and css:
JavaScript
1
5
1
.mapboxgl-popup-content-wrapper {
2
width: 89px;
3
4
}
5
but nothing change. The popup stays white
see image.
So what I have to change?
Thank you
So in css: toggle-layer.component.scss
I have this:
JavaScript
1
5
1
:host ::ng-deep .mapboxgl-popup-content-wrapper {
2
width: 89px;
3
4
}
5
Advertisement
Answer
Should work:
JavaScript
1
9
1
:host ::ng-deep .mapboxgl-popup-content-wrapper {
2
width: 89px;
3
height: max-content;
4
border: 2px solid #BF0404;
5
background-color: rgba(243, 207, 207, 0.7);
6
border-radius: 18px;
7
margin-bottom: 3px;
8
}
9