Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updates instances of pac.element to pac for AC preview. #1609

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions samples/place-autocomplete-element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ async function initMap(): Promise<void> {
// Create the input HTML element, and append it.
const input = document.createElement('input');
const pac = new google.maps.places.PlaceAutocompleteElement({ inputElement: input });
document.body.appendChild(pac.element as HTMLElement);
//@ts-ignore
document.body.appendChild(pac);
// [END maps_place_autocomplete_element_add]

// Inject HTML UI.
Expand All @@ -29,7 +30,8 @@ async function initMap(): Promise<void> {

// [START maps_place_autocomplete_element_listener]
// Add the gmp-placeselect listener, and display the results.
pac.addListener('gmp-placeselect', async ({ place }) => {
//@ts-ignore
pac.addEventListener('gmp-placeselect', async ({ place }) => {
await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'] });

selectedPlaceTitle.textContent = 'Selected Place:';
Expand Down
6 changes: 4 additions & 2 deletions samples/place-autocomplete-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ async function initMap(): Promise<void> {
const pac = new google.maps.places.PlaceAutocompleteElement({ inputElement: input });

const card = document.getElementById('pac-card') as HTMLElement;
card.appendChild(pac.element as HTMLElement);
//@ts-ignore
card.appendChild(pac);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(card);
// [END maps_place_autocomplete_map_add]

Expand All @@ -44,7 +45,8 @@ async function initMap(): Promise<void> {

// [START maps_place_autocomplete_map_listener]
// Add the gmp-placeselect listener, and display the results on the map.
pac.addListener('gmp-placeselect', async ({ place }) => {
//@ts-ignore
pac.addEventListener('gmp-placeselect', async ({ place }) => {
await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'] });

// If the place has a geometry, then present it on a map.
Expand Down
Loading