Skip to content

Commit a5cad10

Browse files
Splaktarmmalerba
authored andcommitted
demo(google-map): minor clarity tweaks to the dev-app demo (#17647)
- remove infoWindowPosition since it is not actually used - and passing in undefined to the @input is a little confusing - also it's type doesn't match the position @input's types - make the first marker visible on initial load - make the first marker clickable to make the demo less confusing - use more semantic HTML
1 parent 440b1b7 commit a5cad10

File tree

4 files changed

+35
-20
lines changed

4 files changed

+35
-20
lines changed

src/dev-app/google-map/BUILD.bazel

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("//tools:defaults.bzl", "ng_module")
3+
load("//tools:defaults.bzl", "ng_module", "sass_binary")
44

55
ng_module(
66
name = "google-map",
77
srcs = glob(["**/*.ts"]),
8-
assets = ["google-map-demo.html"],
8+
assets = [
9+
"google-map-demo.html",
10+
":google_map_demo_scss",
11+
],
912
deps = [
1013
"//src/google-maps",
1114
"@npm//@angular/router",
1215
],
1316
)
17+
18+
sass_binary(
19+
name = "google_map_demo_scss",
20+
src = "google-map-demo.scss",
21+
)
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
<google-map height="400px"
2-
width="750px"
3-
[center]="center"
4-
[zoom]="zoom"
5-
(mapClick)="handleClick($event)"
6-
(mapMousemove)="handleMove($event)"
7-
(mapRightclick)="handleRightclick()">
8-
<map-marker></map-marker>
9-
<map-marker #marker
10-
*ngFor="let markerPosition of markerPositions"
11-
[position]="markerPosition"
12-
[options]="markerOptions"
13-
(mapClick)="clickMarker(marker)"></map-marker>
14-
<map-info-window [position]="infoWindowPosition">Testing 1 2 3</map-info-window>
15-
</google-map>
1+
<div class="demo-google-map">
2+
<google-map height="400px"
3+
width="750px"
4+
[center]="center"
5+
[zoom]="zoom"
6+
(mapClick)="handleClick($event)"
7+
(mapMousemove)="handleMove($event)"
8+
(mapRightclick)="handleRightclick()">
9+
<map-marker #firstMarker [position]="center" (mapClick)="clickMarker(firstMarker)"></map-marker>
10+
<map-marker #marker
11+
*ngFor="let markerPosition of markerPositions"
12+
[position]="markerPosition"
13+
[options]="markerOptions"
14+
(mapClick)="clickMarker(marker)"></map-marker>
15+
<map-info-window>Testing 1 2 3</map-info-window>
16+
</google-map>
1617

17-
<div>Latitude: {{display?.lat}}</div>
18-
<div>Longitude: {{display?.lng}}</div>
18+
<p><label>Latitude:</label> {{display?.lat}}</p>
19+
<p><label>Longitude:</label> {{display?.lng}}</p>
20+
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.demo-google-map {
2+
label {
3+
font-weight: 500;
4+
}
5+
}

src/dev-app/google-map/google-map-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import {MapInfoWindow, MapMarker} from '@angular/google-maps';
1313
@Component({
1414
selector: 'google-map-demo',
1515
templateUrl: 'google-map-demo.html',
16+
styleUrls: ['google-map-demo.css']
1617
})
1718
export class GoogleMapDemo {
1819
@ViewChild(MapInfoWindow) infoWindow: MapInfoWindow;
1920

2021
center = {lat: 24, lng: 12};
2122
markerOptions = {draggable: false};
2223
markerPositions: google.maps.LatLngLiteral[] = [];
23-
infoWindowPosition: google.maps.LatLngLiteral;
2424
zoom = 4;
2525
display?: google.maps.LatLngLiteral;
2626

0 commit comments

Comments
 (0)